Some useful links:
Questions tagged [mongo-java]
315 questions
0
votes
1 answer
Load data from MongoDB to HashMap
i am wondering how can i do to load a HashMap from MongoDB using Java, this is a project of mine for Minecraft & Bukkit. I have saved the data like the following:
private Map petNames = new HashMap();
and i am saving…

ItsErikR
- 11
- 1
- 3
0
votes
1 answer
Error linking to mongoDB java driver
I downloaded the mongo-java-driver-2.11.2.jar file from here -
http://central.maven.org/maven2/org/mongodb/mongo-java-driver/2.11.3/
In my example application i have following code -
import com.mongodb.MongoClient;
import…

Hobby_Web_programmer
- 775
- 2
- 10
- 18
0
votes
2 answers
Is write operations go to secondary when i set readpreference as secondary in mongodb?
I have replication set up (localhost:27017(primary),localhost:27018(secondary),localhost:27019(arb))
I have set the readPrefrence as secondary in connection lever like below
mongoInstance.setReadPreference(ReadPreference.secondary());
When i save…

rajesh
- 35
- 6
0
votes
1 answer
Mongodb - append on duplicate record
I'm trying to accomplish this task in Java using mongodb. Let's say I have a list of employees (firstname, lastname, phone-number). Now, some employees can have more than one phone number.
Let's say I have a list of employees (I'm parsing an xml…

Alistair
- 621
- 1
- 7
- 22
0
votes
1 answer
Hidden replica set do not take part in election
I have a replica set of three server and a backup server, The backup server is made
"hidden"=true and "priority"=0`
My concern is when I have one of my secondary and backup server up, my secondary does not changes into primary, which means hidden…

Phalguni Mukherjee
- 623
- 3
- 11
- 29
0
votes
1 answer
Match Query - MongoDB
Am using mongo to store my documents. And one of them looks like below.
Name:
first: joe
last: blo
address:
city: Paris
state: London
relatives:
first order:
aunt: ashley
uncle: tom
second order
aunt: roma
uncle:…

Karthik Balasubramanian
- 1,127
- 4
- 13
- 36
0
votes
1 answer
Update not inserting a object in subarray,when upsert=true
I am using mongodb update method with upsert=true.
My data looks like this:
{"my_id":"1",
"test_list":[{"test_id":1,"test_name":"pppp"}]}
now I am using the following…

Phalguni Mukherjee
- 623
- 3
- 11
- 29
0
votes
0 answers
Creating MongoDB collections at runtime and deleting it
I am developing an app whose data repo is MongoDB. I have only 2 collections in the database say A and B.
There is only one type of transaction which happens from the application layer. This transaction produces 2 queries and these 2 queries hits…

Timothy Rajan
- 1,947
- 8
- 38
- 62
0
votes
0 answers
db.printCollectionStats() error
I am getting the following error when I run:
db.printCollectionStats()
error: {
"$err" : "stale config on lazy receive :: caused by :: $err: \"[myzips.zips] shard version not ok in Client::Context: this shard contains versioned chunks for…

Phalguni Mukherjee
- 623
- 3
- 11
- 29
0
votes
1 answer
Query related to production environment
I have configured my production environment with the following details:
1. Three config server
2. Two router(mongoose)
3. Two shards of three replica set.
My question is, I am trying to connect to the sharded database with the help of mongo java…

Phalguni Mukherjee
- 623
- 3
- 11
- 29
0
votes
1 answer
Querying tag based replica set
I have configured my replica set with tag fields as given in doc example:
{
"_id" : "rs0",
"version" : 2,
"members" : [
{
"_id" : 0,
"host" : "mongodb0.example.net:27017",
…

Phalguni Mukherjee
- 623
- 3
- 11
- 29
0
votes
1 answer
Aggregate,Find,Group confusion?
I am building a web based system for my organization, using Mongo DB, I have gone through the document provided by mongo db and came to the following conclusion:
find: Cannot pull data from sub array.
group: Cannot work in sharded…

Phalguni Mukherjee
- 623
- 3
- 11
- 29
0
votes
1 answer
MongoDB: how to group by date with mongo date aggregration using java driver
I have been struggling writing to convert a mongo shell command to java query on top of the java mongo driver in order to call it in my webapp project: the command is as follow:
db.post.aggregate(
{
$match: { dateCreated:
{
…

black sensei
- 6,528
- 22
- 109
- 188
0
votes
1 answer
Exception determining maxBSONObjectSize/connection refused because too many open connections using Mule Mongo Connector
I'm using the Mule Mongo Connector to make some operations in a Mongo DB. I have been using it for a while without having this issue, but now I have this exception after running for a while my flow in Mule:
31-ago-2013 23:33:13…

user2417250
- 19
- 7
0
votes
1 answer
Sorting in distinct data
on calling db.distinct() method always return the data in ascending order sorted. Is their a way I can get the data sorted in descending order?

Phalguni Mukherjee
- 623
- 3
- 11
- 29