I am developing a website using Meteor JS and I need to update records in my database based on a username.
var responseId=userAccounts.findOne({likedPostsId:idToSearch, $where: {username:myUsername}});
Basically I want it to return the documents where the likedPostsId match the searched Id and where the username in the collection is the same as the user that is logged in. I am new to Meteor Mongo so probably my syntax is wrong. I would appreciate some help.
I am developing a website using Meteor JS and I need to update records in my database based on a username.
var responseId=userAccounts.findOne({likedPostsId:idToSearch, $where: {username:myUsername}});
Basically I want it to return the documents where the likedPostsId match the searched Id and where the username in the collection is the same as the user that is logged in. I am new to Meteor Mongo so probably my syntax is wrong. I would appreciate some help.
Share Improve this question asked Jun 19, 2017 at 22:46 Roberto ChirilaRoberto Chirila 1251 silver badge10 bronze badges 1- @JohnnyHK Thank you ! It worked ! – Roberto Chirila Commented Jun 19, 2017 at 22:58
1 Answer
Reset to default 5You don't need $where
for that and you can simplify it to:
userAccounts.findOne({likedPostsId: idToSearch, username: myUsername})
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745584884a4634474.html
评论列表(0条)