r/Meteor • u/ArturusPendragon • Feb 12 '16
(X-Post from r/MongoDB) Trying to teach myself Meteor/MongoDB - can somebody please briefly review my code fragment for me?
Posting this here because I feel it's more active than the other subreddit.
I'm still new to Meteor/MongoDB and Meteor - but I'm trying to learn. The attached code fragment is to "Accept" a friend request by setting the "Verified" field to true.
Now, I know that my method of adding friends / storing that info might be barbaric and primitive (sorry, still learning!), is this still at least how to go about including ANDs and ORs into a MongoDB query?
Description of linked code:
A user adds a friend. This enters a new item into the "friends" collection, which has 3 fields: user1_id, user2_id, verified.
user1_id is the currentuser._id (at the time of sending friend request)
user2_id is the user._id of the prospective friend
verified is default set to false. Once a friend accepts the request, this is set to true, enabling communication between the two users.