Created
October 17, 2011 01:30
-
-
Save jasonmccay/1291716 to your computer and use it in GitHub Desktop.
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
// Finally, let's do a basic iteration and display the names of the collections in the NetBeans console. | |
public static void main(String[] args) throws UnknownHostException { | |
Mongo m = new Mongo( "hatch.mongohq.com" , 10004 ); | |
DB db = m.getDB("my_database_name"); | |
boolean auth = db.authenticate("cloudbees", "my_database_password".toCharArray()); | |
Set<String> my_collections = db.getCollectionNames(); | |
for (String s : my_collections) { | |
System.out.println(s) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment