Created
December 8, 2011 15:06
-
-
Save JanPaulEttles/1447217 to your computer and use it in GitHub Desktop.
Updating a document #2
This file contains hidden or 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
| 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