Reputation:
I would like to get one field from the selected documents but I want all of the values to be in a simple array.
users.find({}, ['regid'], function(err, docs){
//console.log(docs);
});
should return:
['reg1','reg2',...]
Thank you
Upvotes: 0
Views: 40
Reputation: 104775
You can do:
users.find({}, {'regid' : 1}).toArray(function(err, docs){
//console.log(docs);
});
Upvotes: 1