Skip to content

Instantly share code, notes, and snippets.

@dalmat36
Created April 3, 2015 16:41
Show Gist options
  • Select an option

  • Save dalmat36/a3a941ef23dd7c3f911f to your computer and use it in GitHub Desktop.

Select an option

Save dalmat36/a3a941ef23dd7c3f911f to your computer and use it in GitHub Desktop.
This code snippet finds all people documents in the "people" collection and prints them to the console.
private static void printAllPeople(){
MongoCursor<Document> people = collection.find().iterator();
while(people.hasNext())
System.out.println(people.next());
System.out.println("\n");
people.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment