node.js - How to find specified fields in mongodb in sails? -


in mysql, can retrieve specified columns using:

user.find({select:['email']})..... 

now moving mongodb, tried:

user.find({select:['email']})..... user.find({},{email:1})..... user.find({},{fields: {email:1}}).... 

but none of them works. how in mongodb ?

btw: using official mongodb driver bellowed, it's quite simple , match api document, rethinking should use official driver(i don't want waste time in asking & solving problem this), don't want lose capacity , flexibility of waterline well. suggestion or advice mush appreciated.

db.collection('user').find({},{email:1}) 

db.user.find({},{"_id":0,"email":1}) 

this working me in mongodb 3.x


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -