Review following documents : Collection : domain { "_id" : 1001, "domainName" : "google.com" "tag" : [ "search engine", "search", "find anything", "giant" ] }, { "_id" : 1002, "domainName" : "yahoo.com" "tag" : [ "search engine", "online portal", ] }, { "_id" : 1003, "domainName" : "mkyong.com" } 1. Question How to find all […]

Read more MongoDB – find all documents where an array / list size is greater than N

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