Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save JanPaulEttles/1447221 to your computer and use it in GitHub Desktop.
Updating a document #3
public class DBObjectFactory {
public final static DBObject fromJson(String json) {
DBObject dbo = (DBObject)JSON.parse(json);
ObjectId oid = new ObjectId((String)dbo.get("_id"));
dbo.put("_id", oid);
return dbo;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment