I have a users table of the following schema
var usersSchema = mongoose.Schema({
uname : {type : String , unique: true},
email : {type : String},
logintype : {type : String},
password : String,
status : String,
hash : String,
social: {},
games: Object,
os: String,
friends: Object,
msges:Object
});
I want to fetch msges
of specific user. I have the username. Currently this is what I am doing
var getMessages = function(user){
global.users.find({"uname" : uname},
{"friends.friendUname":1,_id:0},
function(err,doc){
if(err){
callback(false,err,"",null);
}else{
callback(true,null,"",doc);
}
}
);
}
But I don't want all the fields. Any help?