I am using the mongodb native driver for node.js and can\'t get to work the field selection. What I want to do is to limit fields to name. I do not want the \'last\' in the outp
The recommended way of doing this in v3.0 is with the projection field in the options object:
db.collection('test').find({}, {projection: {name: 1}}).toArray()
As mentioned in the accepted answer, you still cannot mix inclusion and exclusion.
See: http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#find