Some useful links:
Questions tagged [mongo-java]
315 questions
0
votes
0 answers
Error upgrading to Mongo java driver 3.2.2
we have migrated to MongoDB 3.2.6. What could be the compatible mongo version jars for below dependencies,
mongo java driver version (org.mongodb)
spring data mongo version (org.springframework.data)
spring data commons version…

Prasanna
- 141
- 1
- 3
- 17
0
votes
1 answer
mongo_connector.errors.OperationFailed: insertDocument :: caused by :: 11000 E11000 duplicate key error index
I have an existing python method which is doing the update operation properly in mongodb. I got a requirement where if any document modified in mongodb, I need to create a new document in same collection for audit purpose. So I added below piece of…

Prasanna
- 141
- 1
- 3
- 17
0
votes
1 answer
Unable to connect specific mongo instance port
Today morning i'm able to create 2 different mongo instances on port 27010 and 37010 and i'm able to replicate using mongo-connector. But now after system restart i'm not able to connect to port 37010 using below command.
C:\Program Files\MongoDB…

Prasanna
- 141
- 1
- 3
- 17
0
votes
1 answer
Connect to MongoDb using X509 certificate
I am trying to connect to MongoDB using mongoX509. I am using mongo java driver 3.3.0 jar. In api reference I can see MongoCredential to pass subject name and authenticate but i am not able to import this in my code. When I decompile the jar I am…

Sujith Shajee
- 175
- 5
- 18
0
votes
1 answer
Conversion of MongoDB3.0 query to java
I am working on java and MongoDb 3.0 and having one query which I want to convert into java code.
Mongo DB query is as below:
db.users.find({ $or: [ { updated_at:{ $gt:90, $lte:200}}, { updated_at:{ $gt:350, $lte:400}}, { updated_at:{ $gt:560,…

Kamini
- 690
- 2
- 13
- 36
0
votes
0 answers
Nested Array Search in Mongo db using regex
what would be query for searching in nested arrays:
"_id" : "123",
"Array1" : [
{
"field1" : {
"nestedArray1" : [
{
"content" : "This string inside %nestedArray%",
}
…

svs teja
- 957
- 2
- 22
- 43
0
votes
0 answers
How to convert mongo query to java code
i have this a little complex javascript code to query the data from mongo shell. how can i get the java eqivalent of this without much efforts, i was going through the lot of tutorials but all seems required great effort to achieve the same result…

user29578
- 689
- 7
- 21
0
votes
0 answers
Mongo Types NumberInt NumberLong
Using the Mongo Java Driver if you insert the following document:
Document Monday = new Document()
.append("counter",1)
.append("model1", data1)
.append("model2", data1)
.append("model3", data1)
.append("model4", data1);
counter I would have hoped…

DevilCode
- 1,054
- 3
- 35
- 61
0
votes
1 answer
How to append new value to a list in mongodb?
I want to insert a new element the "CarList" array below. I am using MongoDB and dropwizzard in my project.
{
"_id": "56aa6119bf78f37eee64697e",
"name": "Jack",
"occupation": "business*emphasized text* owner",
"carList": [{
…

matuda
- 195
- 2
- 16
0
votes
1 answer
Find near query MongoDB with Java
I need to "translate",in java, this shell query (MongoDB):
db.runCommand( { geoNear: 'test', near: {type: "Point", coordinates: [115.0. 12.0]}, spherical: true, maxDistance: 40000})
I use mongo-java-driver:3.1.0, i test this query with shell and…

ElMariachi25
- 186
- 4
- 14
0
votes
1 answer
Getting a value from an inner array from Document MongoDB Java
I'm using the JAVA Driver and am performing a document find.
The returned documents are of type Document.
From the code I can see the String type('name') which comes out correctly.
I can also see the hours array as a string.
What i am looking to do…

DevilCode
- 1,054
- 3
- 35
- 61
0
votes
1 answer
How to get the results as a value
I am trying to make a program that finds the coordinate values x and y from the database of mongoDB. After,to subtract these values to find every time their various and to search for the position of the new coordinate.
The structure of the results…

William
- 33
- 1
- 10
0
votes
1 answer
Using mongodb with java
I'm searching in the database for the URL but with this code I can not. Why? Normally I want to print all the type and the URL where exist in this database. When I have the print only with the type is working but with the print for URL…

William
- 33
- 1
- 10
0
votes
1 answer
Java - MongoDB - Map Json object as Java Array
I've got an XML configuration mapped to a JSON document which has an array of elements, but when there is only one element, the document looks like this:
{
"name" : "test2"
"products" : {
"id" : "prod3"
"value" :…

peter_f
- 258
- 1
- 2
- 11
0
votes
2 answers
Java MongoDB: querying with numberLong field
How do I query in mongoDB using the mongoDB java driver for a numberLong field?
I tried this according to this SO post: Java Mongodb numberlong query but it does not work.
Query query= new…

Simon
- 19,658
- 27
- 149
- 217