MongoDB Java driver – problems with aggregation

In Java with MongoDB driver I want to have pairs (business_name, count), meaning reviews count per business. Currently I have aggregate pipeline: Bson group = group(“$business_id”, Accumulators.sum(“count”, 1)); Bson lookupOperation = lookup( “business”, “_id”, “business_id”, “business_data” ); Bson unwind = unwind(“$business_data”); Bson project = project(fields(include(“business_data.name”, “count”), excludeId())); return db .getCollection(“tip”) .aggregate(Arrays.asList(group, lookupOperation, unwind, project)); It…

How to create a method for a mongoDB connection, and write query in different method in Java?

I have created a method for MongoDB connection and I am able to print all document from the collection. public static void connectMongowithURI_1() { String db_name = “YYYY”, db_col_name = “XXXX”; String client_url = “mongodb:localhost XXXXX”; MongoClientURI uri = new MongoClientURI(client_url); // Connecting to the mongodb server using the given client uri. MongoClient mongo_client =…

MongoDB: “Unknown top level operator ‘nameOnly’ ” error from Java, but everything is ok from Mongo Shell

We have an interesting problem. We have a java application (Java 8, Spring boot, MongoDB driver 3.8.2) with a simple MongoDB GUI tool. Case 1. My dev local machine. MongoDB 3.6.0. Non-admin user. Part of the java-code: mongoClient.listDatabaseNames() returns list of the available database names. Everything is fine. Case 2. Remote server. MongoDB 3.6.0. Non-admin…

Auto-remove ‘/var/lib/juju’ when I restarting jujud with empty juju’s data in mongodb

I take some time to learn high available topic. And I try many time regarding disaster failure drill.But I found the path of ‘/var/lib/juju’ was remove in the situation of no data in mongodb when I try restart jujud. what’s wrong? my requriments is that the directory of ‘/var/lib/juju’ is not deleted in the situation…