Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
141 views

I'm trying to develop Flink java api maven program which inserts several documents into MongoDB. I use the following Flink environment. Flink: 2.0 MongoDB: 8.0 OS: Windows 11 JDK: 17.0.2 pom.xml: &...
Joseph Hwang's user avatar
  • 1,433
0 votes
0 answers
112 views

while upgrading mongo-driver to 5.x getting following error while connecting mongo DB. Caused by: java.lang.ClassNotFoundException: com.mongodb.internal.TimeoutSettings at java.base/jdk.internal....
ameenulla hussaini's user avatar
0 votes
1 answer
496 views

I am trying to upgrade mongo-java-driver:3.12.14 to mongodb-driver-sync:4.11.1. After making all the necessary changes and resolving compilation errors, i am getting this runtime issue of ...
Smriti Sharma's user avatar
0 votes
1 answer
105 views

Previously we were using mongo-java-driver 3.10.2 there is a getAddress() method in MongoClient derived from the super class, Mongo. We needed to switch to mongo-driver-legacy 4.11.1 to be able to ...
Olgun Kaya's user avatar
  • 2,585
0 votes
0 answers
210 views

I'm not much aware of kerberos.Kerberos server is running on an ec2 instance,on another ec2 instance,installed kerberos client and mongodb 6.0.2 enterprise and mongo shell 1.10.6.I created user ...
prathyusha magam's user avatar
1 vote
1 answer
359 views

How can I convert a Java (/Scala) BsonArray to a json string? If I have val array = new BsonArray() array.add(new BsonInt32(1)) array.add(new BsonInt32(2)) it would be nice if "array.toJson"...
Marc Grue's user avatar
  • 5,375
0 votes
1 answer
131 views

This might be a slightly unconventional scenario, but let me explain my situation. I have multiple clients that communicate with a central server. These clients send Bson queries to the server, which ...
Kihz's user avatar
  • 121
0 votes
1 answer
3k views

I'm storing a UUID in Mongo DB and when I want to read it again from MongoDB with UUID.fromString(document.getString("userId")) I get: class java.util.UUID cannot be cast to class java.lang....
hb0's user avatar
  • 4,065
-1 votes
1 answer
150 views

After updating the mongo driver version from 3.8.1 to 4.6.1. I am getting below error in my existing queries "Unrecognized pipeline stage name: '$and'" All the aggregations were working ...
HMT's user avatar
  • 2,281
1 vote
1 answer
405 views

@Test public void test() { int userId = Math.abs(new Random().nextInt() % 10) + 1 HTTPResponse response = request.GET("http://127.0.0.1:8030/feed-server/feed/" + {userId} + "?...
happy's user avatar
  • 33
0 votes
1 answer
595 views

I have a problem which has me stumped. Hoping someone can help me here. So I'm sadly in the position of having a micro-service which for the moment needs to connect to 4 mongo databases all running in ...
MetaCoder's user avatar
  • 488
0 votes
1 answer
211 views

I'm about testing using MongoDB. Instead of Micronaut Test Resources I'm using local hosted docker container for database (I prefer to see the result). Many my tests depends on MongoDB but some throws ...
frynet's user avatar
  • 26
0 votes
1 answer
397 views

I'm trying to insert a few million documents into MongoDB in one operation. Using MongoCollection.insertMany does not work for me because it takes a List as input and my data does not fit in memory. ...
fafl's user avatar
  • 7,507
1 vote
0 answers
56 views

I'm working on an event collection, where each document is modeled like so: { "event_name": "John Doe Concert", "event_date": "2022-01-01" "ticket_types&...
Lorenzo Valente's user avatar
0 votes
1 answer
232 views

db.collection.aggregate([ { $match : { filterQuery} }, { $addFields :{ “customGradeOrder” : { $indexOfArray: [ [“Gold”, “Silver”, “Bronze”] , “$grade” ] }} },{$sort : { customGradeOrder : 1 } } ]); ...
Madhav Kumar Jha's user avatar
0 votes
1 answer
242 views

I have the below data, and I want to filter the data for _id = "63283dd5777142017baa763b" and subCategory._id = "63283e25777142017baa7641" { "_id": ObjectId("...
San Jaisy's user avatar
  • 17.4k
2 votes
0 answers
2k views

I'm working on JDK8 and using mongo-java-driver(v3.5.0) to connect MongoDB(v3.6.3). I've enabled SSL by following this article. I don't have /etc/mongod.conf file, instead I've /etc/mongodb.conf file; ...
dev-eloper's user avatar
1 vote
0 answers
2k views

I am upgrading my spring boot application from 2.2.7.RELEASE to 2.6.7. In this application i am using mongodb 2.2.12.RELEASE and mongodb-java-driver 3.8.2. application build successfully but when I ...
Prem's user avatar
  • 101
1 vote
0 answers
1k views

We are trying to update our spring boot to 2.7.1. We have old mongo java dependencies as <dependency> <groupId>org.mongodb</groupId> <artifactId>mongo-java-driver</...
Anish Sharma's user avatar
0 votes
1 answer
175 views

I am experimenting with Java and MongoDB and I am making a lookup aggregation. I noticed that when I perform a lookup the document returned contains the lookup field as an Array of documents - as a ...
SpmiR's user avatar
  • 45
0 votes
0 answers
244 views

I am looking for solutions to get field name and type for all nested fields including array of documents using $project $mergeobjects, $objectToArray , $unwind. collection.aggregate(Arrays.asList( ...
newbie's user avatar
  • 1
0 votes
1 answer
286 views

I have code in Java that performs an aggregation pipeline roughly: List<Bson> aggUpdate = Arrays.asList( match(...), project(...), lookup(...), ... merge(...) ); AggregateIterable&...
Robert's user avatar
  • 1,372
1 vote
1 answer
502 views

I want to push the previous state (if the values changed) during an upsert into an array history (atomar) but no matter what I try, I can't find a clean solution. Below you find simplified attempts: ...
hb0's user avatar
  • 4,065
0 votes
0 answers
178 views

I am trying to store _id as a String in Mongo, but for some reason, mongo is still overriding and storing it as an ObjectId. Below is my Java class public class Subscription { @JsonProperty(&...
BrownTownCoder's user avatar
0 votes
1 answer
958 views

Using the latest Micronaut 3.4.1 with micronaut data and MongoDB. Keep getting the exception as java.lang.NoClassDefFoundError: org/bson/internal/CodecRegistryHelper Gradle Dependencies dependencies { ...
San Jaisy's user avatar
  • 17.4k
0 votes
1 answer
872 views

I'm using mongo-java-driver to store POJOs in MongoDB and so far I've had no issues, with doing just this: CodecProvider pojoCodecProvider = PojoCodecProvider.builder().automatic(true).build(); ...
pypat's user avatar
  • 1,116
0 votes
1 answer
702 views

I'm trying to use POJOs to write data to MongoDB, but I can't seem to get it working. I have a lot of different data structures because I'm storing various types of chart data. Let's start with the ...
John Manko's user avatar
  • 1,972
1 vote
0 answers
58 views

I want to connect my Java application with gridfs with read preference as secondaryPreferred, preferably using spring-data-mongodb 1.10.1
NKS's user avatar
  • 11
2 votes
1 answer
4k views

I have java application based on mongo server 4.2 and component versions are as follows spring-boot 2.2.5.RELEASE spring-data-mongodb2.2.5.RELEASE mongo-java-driver3.12.1 I updated spring boot to 2.5....
Rohit Shete's user avatar
1 vote
1 answer
2k views

Can't find an answer on stackOverflow, nor in any documentation, I have the following change stream code(listen to a DB not a specific collection) Mongo Version is 4.2 @Configuration public class ...
Roie Beck's user avatar
  • 1,175
0 votes
1 answer
540 views

Using MongoDB driver 4.1.0 (and quarkus 1.1.1), I have an entity with a composite _id: @BsonId @JsonProperty("_id") private CompositeId id = new CompositeId(); @Data @AllArgsConstructor @...
Ori Dar's user avatar
  • 19.1k
0 votes
1 answer
950 views

I was trying to get the BSON document out of the MongoDB. As per the https://www.mongodb.com/json-and-bson , i am expecting the document received from the driver as : {"hello": "world&...
sabareesh babu's user avatar
1 vote
1 answer
1k views

I'm trying to update many objects within a nested array when their IDs exist in a list. The document structure is like so: { id: p00, children: [{ id: c00, value: true ...
Half_Duplex's user avatar
  • 5,246
1 vote
0 answers
670 views

I'm trying to use flapdoodle embedded mongodb for writing the unit tests. But I was receiving the following error. "java.lang.NoSuchMethodErrror:'com.mongodb.connection.ConnectionPoolSettings$...
Kotagiri Sathwik's user avatar
0 votes
0 answers
290 views

I want to get bulk write metrics from Mongo server, like count of insertions, deletions, modifications, but the following methods always return 0. BulkWriteResult.getInsertedCount() BulkWriteResult....
Sumit Aich's user avatar
2 votes
1 answer
2k views

I have an application that stores data in the used MongoDB Atlas (Cluster Tier: M0 Sandbox Shared RAM, 512 MB Storage) collection as a transaction. The sample code is as follows. MongoClient ...
Sajitha Liyanage's user avatar
0 votes
0 answers
1k views

I've started mongod instance in kerberos auth mode.I'm able to connect from mongo shell.While connecting from java application,I get the following exception: Key for the principal mongodb/****@**** ...
prathyusha magam's user avatar
0 votes
0 answers
336 views

I have a document that has a nested document set as the "name" variable: Document{{name=Document{{he=דמטריוס הכרונוגראף, en=Demetrius the Chronographer}}}} It is contained in a mock database ...
smtanami's user avatar
0 votes
1 answer
2k views

I am trying to search through a mongo database to find a user given search term in one of the fields: @GetMapping(value = {"/classes/search/{term}"}) public String className ( ...
shad0w's user avatar
  • 15
0 votes
1 answer
692 views

I am setting the mongo logger as below <logger name="org.mongodb" level="debug"/> When I run the query using java driver in Micronuat application DEBUG org.mongodb.driver....
San Jaisy's user avatar
  • 17.4k
1 vote
0 answers
775 views

After upgrading mongo dependency, the save() method no longer exists. What's the alternative? Old: DBObject dbObject = new BasicDBObject(items); DBCollection dbCollection = ...
user avatar
3 votes
0 answers
1k views

I am trying to connect my java bot to Mongo Atlas but facing this error com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=...
Aman Kumar's user avatar
0 votes
2 answers
756 views

I am trying to retrieve values of _id for inserted documents after successful InsertMany operation. To achieve this I am using InsertManyResult.getInsertedIds(). While this approach works most of the ...
Miroslav Vacek's user avatar
1 vote
0 answers
505 views

I'm not a Mongo expert. I'm trying to update the complete document by replacing with the new one. I have the following fields in the existing document in the collection qid, column a, column b, column ...
Syed's user avatar
  • 2,607
2 votes
1 answer
3k views

I am very new to MongoDB. Trying to understand the best option to perform Bulk Write in MongoDB. I want to periodically refresh my Application collection. The key's for documents are AppID, AppName ...
Shibankar's user avatar
  • 856
2 votes
1 answer
1k views

We use oplog collection(that is present in local database) in our code to check if an event happens on a specific db and fire an event in our code.But,as aws document db doesn't support oplog as ...
prathyusha magam's user avatar
2 votes
3 answers
9k views

I’m attempting to build my own application and backend API to further my understanding of the Mongo Java driver after completing the M220J course, but am running into a blocker. Context I’m creating a ...
Ian's user avatar
  • 41
0 votes
1 answer
2k views

I am trying to get result of this MongoDB query on java. db.fileTree.aggregate([ { $match: { "_id": "6062144bb25e4809548ef246", } }, { ...
Karthik Chennupati's user avatar
1 vote
2 answers
2k views

I need some help with a project I am planing to do. At this stage I am trying to learn using NoSQL Databases in Java. I've got a few nested documents looking like this: MongoDB nesting structure Like ...
Karuzo Rodriguez's user avatar
0 votes
1 answer
537 views

E.g. I have such documents in the collection: { "key": "key1", "time": 1000, "values": [] // this one is optional } I need to update the collection ...
Andrii Abramov's user avatar

1
2 3 4 5
7