In Java, you can use db.getCollection(“your collection name”) to get a single collection to use. DBCollection collection = db.getCollection("yourCollection"); If you do not know the collection name, use db.getCollectionNames() to get the entire list of collection names from a selected database. DB db = mongo.getDB("yourdb"); Set<String> collections = db.getCollectionNames(); for (String collectionName : collections) { […]

Read more Java MongoDB : Get collection from database

When Staring the mongoDB server, it hits below errors, and the mongoDB server is unable to start. ************** old lock file: \data\db\mongod.lock. probably means unclean shutdown recommend removing file and running –repair see: http://dochub.mongodb.org/core/repair for more information ************* Mon May 09 12:37:43 [initandlisten] exception in initAndListen std::exception: old lock file, terminating Mon May 09 12:37:43 […]

Read more old lock file: \data\db\mongod.lock, probably means unclean shutdown

This Article is outdated! Please refer to this latest guide to install MongoDB as Windows Service. A guide to show you how to installed MongoDB on Windows. 1. mongod –help Get to know all the Windows service related commands by typing “mongod –help“. C:\MongoDB\bin>mongod –help Windows Service Control Manager options: –install install mongodb service –remove […]

Read more How to run MongoDB as Windows Service