Last active
August 29, 2015 14:18
-
-
Save dalmat36/feb6b88a44d97cff7db6 to your computer and use it in GitHub Desktop.
This snippet of code connects to MongoDB running on a local machine and gets the "people" collection from the "mydb" database. (collection is defined as a global variable here)
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
| MongoClient mongoClient = new MongoClient( "localhost" , 27017 ); | |
| MongoDatabase database = mongoClient.getDatabase("mydb"); | |
| collection = database.getCollection("people"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment