Skip to content

Instantly share code, notes, and snippets.

@JanPaulEttles
Created December 8, 2011 15:06
Show Gist options
  • Select an option

  • Save JanPaulEttles/1447217 to your computer and use it in GitHub Desktop.

Select an option

Save JanPaulEttles/1447217 to your computer and use it in GitHub Desktop.
Updating a document #2
DBCollection collection = db.getCollection("collection");
DBObject dbo = (DBObject)JSON.parse(json);
ObjectId oid = new ObjectId((String)dbo.get("_id"));
dbo.put("_id", oid);
collection.save(dbo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment