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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -