How to return only value of a field in mongodb

Not sure what you language implementation is but the basic concept is:

var result = []
db.users.find().forEach(function(u) { result.push(u.text) })

And the returned value to result is:

["Hey","Hi","Hello","yes"]

Leave a Comment