Last active
December 12, 2015 10:09
-
-
Save xosofox/4756807 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Meteor.isServer) { | |
// update the appropriate rsvp entry with $ | |
Parties.update( | |
{_id: partyId, "rsvps.user": this.userId}, | |
{$set: {"rsvps.$.rsvp": rsvp}}); | |
} else { | |
// minimongo doesn't yet support $ in modifier. as a temporary | |
// workaround, make a modifier that uses an index. this is | |
// safe on the client since there's only one thread. | |
var modifier = {$set: {}}; | |
modifier.$set["rsvps." + rsvpIndex + ".rsvp"] = rsvp; | |
Parties.update(partyId, modifier); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://docs.mongodb.org/manual/reference/operator/positional/
Looks like a workaround for the minimongo library's overly strict validation of
find()
andupdate()
arguments. Perhaps it complains about using$
as a component in a field path.