Skip to content

Instantly share code, notes, and snippets.

@esedor
Created November 11, 2011 00:08
Show Gist options
  • Save esedor/1356703 to your computer and use it in GitHub Desktop.
Save esedor/1356703 to your computer and use it in GitHub Desktop.
Querying MongoDB in Java
locations = database.getCollection("locations");
locations.insert(new BasicDBObject("name", "Arganis"));
locations.update(new BasicDBObject("name", "Arganis"),
new BasicDBObject("$set",
new BasicDBObject("leader",
"King Argan III")));
DBCursor results = locations.find(new BasicDBObject("leader", "King Argan III"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment