Search code examples
node.jssails.jsorientdbwaterlinenosql

How to get DB object in SailsJS / Waterline adapter methods?


I am trying to write a SailsJS / Waterline adapter for OrientDB using Oriento module for NodeJS.

I am able to understand the basics of Waterline adapter interface using boilerplate adapter code for SailsJS but not sure how to get hold of DB object in adapter methods. I am sure DB object is created and maintained by SailsJS or Waterline but how to get an access to it in adapter's methods as without DB object, I will not be able to make call to OrientDB. Look for code samples in Oriento module to know how to call OrientDB from NodeJS.

I will appreciate if some one can show some example code of getting DB object in adapter's method - define(), describe(), drop(), find() etc.


Solution

  • We're unfamiliar with Sails, but looks like the _dbPools private variable is what you're looking for - https://github.com/balderdashy/sails-adapter-boilerplate/blob/master/index.js#L59