I have a NodeJS application with Mongoose ODM. I want to select three separate fields from the collection. An example of my collection is "Users" with the fields "_id", "username", "email", "usertype", "password" ... I want to select only the username, 'email' and 'usertype'. That was my code.
var query = models.User.find({}).select('UserName', 'Email', 'UserType');
This worked fine with mongoose 2 version, I upgraded to Mongodb 2.2 and Mongoose 3.3.1. Now i get an error
500 TypeError: Invalid select() argument. Must be a string or object.
Can anyone suggest a solution?
dany
source share