Skip to content

Instantly share code, notes, and snippets.

@danielkhan
Created December 12, 2013 15:23
Show Gist options
  • Save danielkhan/7929716 to your computer and use it in GitHub Desktop.
Save danielkhan/7929716 to your computer and use it in GitHub Desktop.
for {
res <- collection.update(Json.obj("slug" -> idea_slug, "user_id" -> Json.obj("$ne" -> vote.user_id)),
Json.obj("$addToSet" -> Json.obj(addType -> vote),
"$pull" -> Json.obj(removeType -> Json.obj("user_id" -> vote.user_id)),
"$addToSet" -> Json.obj("metrics.attachedUsers" -> vote.user_id))
, getLastError, false)
idea <- findOne(Json.obj("slug" -> idea_slug))
} yield {
idea
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment