Some useful links:
Questions tagged [mongo-java]
315 questions
2
votes
1 answer
Can I use JNDI to share a MongoClient instance?
I'm using Jetty for a web server. I have built a custom LoginService/realm that uses MongoDb to get users. This LoginService is in it's own jar and is on the jetty server container's classpath.
I also want to use MongoDb in my web application.…

Ben Zuill-Smith
- 3,504
- 3
- 25
- 44
2
votes
1 answer
Sort working opposite
I have a mongo collection:
/* 0 */
{
"_id" : ObjectId("51f1fcc08188d3117c6da351"),
"cust_id" : "abc123",
"ord_date" : ISODate("2012-10-03T18:30:00Z"),
"status" : "A",
"price" : 25,
"items" : [{
"sku" : "ggg",
"qty" : 7,
…

Phalguni Mukherjee
- 623
- 3
- 11
- 29
2
votes
1 answer
Querying more than one condition for sub array kind of document with $where
I have a document which looks like this:
{
"_id" : ObjectId("50a8240b927d5d8b5891743c"),
"cust_id" : "abc",
"ord_date" : ISODate("2012-10-03T18:30:00Z"),
"status" : "A",
"price" : 25,
"items" : [
{
"sku" : "mmm",
"qty" :…

Phalguni Mukherjee
- 623
- 3
- 11
- 29
2
votes
1 answer
Mongo shard collection not distributed if shard key is a small int
We did mock test on the sharded mongo environment, but if the shard key value is small int, the collection didn't distribute, but if the shard key is big int, its working fine. Please read on...
Code used to insert records from mongos shell.
var…

Samba
- 607
- 4
- 19
2
votes
1 answer
How to clone a mongodb collection programmatically through Mongo Java driver of Spring Data MongoDB?
I want to clone a collection to a backup collection, before processing all the entries in it through my Spring controller.
On searching, I came to know about various ways to do so through terminal. There is also a possibility to use executeCommand…

Vishal
- 189
- 3
- 11
2
votes
3 answers
Find objects by array in mongodb (or java)
I've got a collection (dataset) like this:
{
"_id" : ObjectId("515611c1c6e3718ee42a5655"),
"id": "Product1",
"type": "ProductType4"
"productFeature": [
{
"id": "ProductFeature1"
},
{
"id": "ProductFeature2"
},
…

Viktor
- 111
- 1
- 1
- 8
2
votes
3 answers
Morphia is there a difference between fetch and asList in performance wise
We are using morphia 0.99 and java driver 2.7.3 I would like to learn is there any difference between fetching records one by one using fetch and retrieving results by asList (assume that there is enough memory to retrieve records through…

cubbuk
- 7,800
- 4
- 35
- 62
2
votes
3 answers
Play! 2 Framework - Add Java Mongo driver
I am trying to use the java mongo driver with Play!.
So I read though:
http://www.playframework.org/documentation/2.0.2/SBTDependencies
http://www.mongodb.org/display/DOCS/Java+Tutorial
I added the buildpath in eclipse. But play can't find the…

Maik Klein
- 15,548
- 27
- 101
- 197
2
votes
2 answers
Mongo DB pool connection error
I am using mongoDb with java. I am getting the following error while inserting data. Any help would be appreciated. Thanx
Jul 4, 2012 1:45:32 PM org.xsocket.connection.HandlerAdapter performOnData
WARNING: [6f829b013850ff7914137a5cceC291] closing…

shalki
- 890
- 3
- 14
- 31
1
vote
2 answers
GeneratePDF with JasperReports Library and MongoDB
Here is my GeneratePdf.java
Import ...
public class GeneratePdf {
public static void main(String[] args) {
try {
JRDataSource ds = getDatasource();
// - Chargement et compilation du rapport
line32 …

Louis
- 622
- 2
- 10
- 26
1
vote
1 answer
JasperFillManager.fillReport and mongo?
I'am currently following a tutorial ( http://kristantohans.wordpress.com/2010/03/01/new-to-jasperreport-build-your-first-impressive-application-part-2/ )
and he use a java db connection (conn)
50 try {
51 //Fill the report with…

Louis
- 622
- 2
- 10
- 26
1
vote
1 answer
In mongo shell can't find collection elements, but they were saved and loaded via Java driver
Start server:
bin\mongod.exe -dbpath=D:\mongo\dbs -rest -logpath=logs\server.log -logappend -noauth
In java:
Mongo mongo = new Mongo("localhost", 27017);
DB db = mongo.getDB("test_db");
DBCollection collection =…

alexey_p
- 21
- 7
1
vote
1 answer
Mongo Java: Set values and push to array with previous values in one command
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:
Attempt 1: Use $set and $concatArrays
final var…

hb0
- 3,350
- 3
- 30
- 48
1
vote
0 answers
UpdateOneModel adds new fields to existing document in mongodb java-driver
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 c
The new document has the following…

Syed
- 2,471
- 10
- 49
- 89
1
vote
3 answers
Mongodb: client side user authentication security issue
I am using Mongodb Java driver for my Java client application. it needs to connect to mongodb server running remotely.
I am concerned that someone could decompile jar and find out the ip address to the mongodb server and access it. but the user…

KJW
- 15,035
- 47
- 137
- 243