admin管理员组文章数量:1431435
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})
本文标签: javascriptMongo DB findOne with multiple argumentsStack Overflow
版权声明:本文标题:javascript - Mongo DB findOne with multiple arguments - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745584884a2664840.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论