Skip to content

Instantly share code, notes, and snippets.

@bootandy
Created June 26, 2012 16:37
Show Gist options
  • Save bootandy/2996950 to your computer and use it in GitHub Desktop.
Save bootandy/2996950 to your computer and use it in GitHub Desktop.
pymongo - showing how to update multiple nested docs
def bulk_invite(self, user_ids, group_id, invite_message):
self.db['user_details'].update( { '_id' : { '$in' : user_ids } },
{ '$set' : { 'group_invites.' + str(group_id) : invite_message} }, multi=True, safe=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment