In mysql, I can retrieve specified columns by using:
User.find({select:['email']}).....
Now I am moving to mongodb, I tried:
User.find({select:['email']}).....
User.find({},{email:1}).....
User.find({},{fields: {email:1}})....
But none of them works. How could I do this in mongodb ?
BTW: I could do this by using official mongodb driver like bellowed, it's quite simple and perfectly match with the API document, so I am rethinking should I use the official driver(I don't want to waste time in asking & solving problem like this), But I don't want to lose the capacity and flexibility of waterline as well. Any suggestion or advice is mush appreciated.
db.collection('user').find({},{email:1})
This is working for me in MongoDB 3.x