-1

When trying to use Waterline standalone mode, I could not find the correct method to perform native queries. With Sails.JS the sendNativeQuery method is used which I could not find in the instances of the models. Does anyone know how I can perform these queries?

Thank you!


I have the same problem, i think it sail who set getDatastore() and sendNativeQuery() function on model and datastore.

Surely on this file: https://github.com/balderdashy/sails-hook-orm/blob/master/lib/build-registered-datastore-instance.js and the function is defined here: https://github.com/balderdashy/sails-hook-orm/blob/master/lib/build-registered-datastore-instance.js

Im going to implement this in my code but if someone have a better idea or have already doing this i appreciate help :)

Samuel Liew
  • 68,352
  • 105
  • 140
  • 225

1 Answers1

0

Sails enables you to access what called datastore.manager

Depending on the adapter, this might represent a connection pool, a single connection, or even just a reference to a pre-configured client library instance.

If you are using MongoDB for example, you can have a raw Mongo collection instance.

see here.

Hamza Fatmi
  • 1,127
  • 6
  • 10
  • Yes! but, the problem is that I'm not using Sails.js, I'm just using Waterline + Express and the models I created do not have the way to make native queries. Thank you! – dragons0458 Apr 12 '18 at 23:16