MongoDB is a scalable, high-performance, open source, document-oriented database. This tag is used for questions related to the Java language bindings and drivers for MongoDB.

learn more… | top users | synonyms

0
votes
1answer
3 views

Translating MongoDB query to a MongoDB java driver query

Please help me translate the following MongoDB query to a java based Query using the Java MongoDB driver. Thank You. db.playerscorecollection.aggregate( { $unwind: "$scorearray"}, { ...
0
votes
1answer
21 views

MongoDB Java Driver Infinite loop while reading results

I am reading MongoDB results using the following code , however the while loop runs in an infinite loop always iterating over the first element in the collection, can someone point out what I am doing ...
0
votes
1answer
31 views

Creating a mongodb query in Java with $or and $in

I am trying to write a java code using mongodb api to create this mongodb query: { "$or": [{"prd" : {"$in" : ["1234", "0987"]}} , {"rsin" : "3228742"}]} Here's the code I am working with so far: ...
2
votes
0answers
21 views

Selecting only one column in mongo db using morphia

I have 2 columns String id, String Name and long age. As we would have done in sql - select id FROM USERDETAILS Where Age > 5 would give me arrayList of primary keys that is "Id". can anyone tell me ...
-1
votes
1answer
84 views

What is the best practice for joins in MongoDB?

I have two class called School and Student as you see. I want to search for "students that school names are bla bla bla" and "schools that have students which has higher grade than 90". I read some ...
1
vote
1answer
38 views

Mongo db how to save an object

Below code gives error and it says School class must implement DBObject interface. The problem is that this interface has tons of methods. I have nearly 100 class and I don't want to write millions of ...
0
votes
0answers
15 views

MongoInternalException: DBPort.findOne failed while running on GAE localserver

I am trying to connect to remote MongoDB (mongolab) from my local GAE server (localhost/8888). I am using morphia and my mongodb driver version is 2.4. My code looks like this: Mongo m = new ...
1
vote
2answers
45 views

Unable to delete object using datastore, query (with `id`) on dao and ds return zero result

I'm trying to delete an object from datastore but it's not deleting it. Code is given below: MoIADocument moIADoc = new MoIADocument(); // update fields in moIADoc object ds.save(moIADoc); ...
0
votes
1answer
36 views

$near query through Java

I want to run a $near query on a collection through Java. I am not sure how to use QeuryBuilder or BasicDbObject for this. What is the correct way to run $near query through Java code. Below is my ...
1
vote
1answer
30 views

mongodb: java: How to update a field in MongoDB using expression with existing value

I need to update a field using some expression. Given a DBObject query, how can I multiply or divide given field by an argument value? How can I write a function performing operation something like ...
0
votes
1answer
26 views

Indexing MongoDB collection in Java

I am creating a collection in mongoDB in the following way and I want to create a 2dsphere index on location field of this collection from Java code. But I am not able to do so. ...
0
votes
1answer
47 views

Increase performance on MongoDB query

I have a 4GB mongodb database holding ip to geo data. The data looks like this: { "_id" : ObjectId("51d1c15d3a673a1a57f20251"), "IP_FROM" : NumberLong(1168612352), "IP_TO" : NumberLong(1168612607), ...
0
votes
2answers
26 views

CSV to GeoJSON conversion

I want to convert a CSV line into a GeoJSON object. I am using CSVReader. Hence, nextLine[] has all the separated tokens. I want to create BasicDBObject which has various attributes stored. I am doing ...
-1
votes
0answers
16 views

Call external service in map function

I saved my document info in MongoDB and I'd like to create a map/reduce job where for each document, I call an external service in a synchronous manner. For example, I'd like to call my service in a ...
0
votes
0answers
58 views

Word Counting Loop

I'm have a program that keeps up with the how many times a words occurs in a string. I also need to be able to keep up with the word that comes directly after the word that is counted and keep up with ...

1 2 3 4 5 14
15 30 50 per page