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.
My application is running mongodb 2.4.8 using 2.11.2 version of java driver. It always end up with mongo taking too much cache on my RHEL when there are too many objects in the database. Almost 4GB of my total 8GB is mostly cached. Even if i try to…
I am using below query to fetch data from mongo-db:
db.FetchedUrl.aggregate({
"$match": {
"type": db.eval('echoFunction(\"news\")')
}
})
This is my stored function:
db.system.js.save({
_id: "echoFunction",
"value": function(x){return…
I try to rewrite this mongodb query (that works in command line):
db.projects.update({"tools.name" : "gitlab"}, {"$set" : {"tools.$.status" : "error"}})
in java:
DBObject queryUpdate = new BasicDBObject("tools.name",…
As explained here, db.bios.remove() deletes all the documents from the bios collection of currently connected DB. What is the equivalent method for this functionality in MongoDB Java API?
I did not find any methods like DB.removeCollection(..) or…
My app is dynamically generating a mongo query via a QueryBuilder. I'm trying to make it so that the passed text can be compared against several fields in my collection. I need to iterate through data in order to know what to add to the $OR (…
how can I get a field from a inner document in mongodb?? For example if I give a field called "idMovie", I would get the rest of field that correspond to this idMovie.
I'm using this code:
MongoClient mongo = null;
DBCursor cursor =…
I have a user, and inside I keep a list of items he has rated.
> db.users.findOne()
{
"_id" : ObjectId("5321985944aebf2ca6f2075f"),
"ratings" : [
{
"532192d344aebf2ca6f2075e" : 0
},
{
…
I'm trying ask if a field exist inside a document inside another document in an mongodb database using java driver. The field that I asking for is idMovie.
For example, I expect that it print in the console "idMovie value already exist" if idMovie…
I have two MongoDB running in two different servers connected via LAN. I want to replicate records from few collections from server 1 to collections in server 2. Is there any way to do it. Below is the pictorial representation of what I want to…
We have got an nested object in the mongo db collection e.g. profile object has got array of address and contacts data.
{
"_id" : "f714af57-b4bd-4c1d-b09c-88f71a446262",
"_class" :…
I am pretty much new in Mongodb now what I want to do is to insert a pdf file of 3MB using JAVA driver and want change the chunk size from 256 to 1mb and then want to retrieve the second chunk say 2nd page of the pdf document.
How can I do…
I've an data in a collection as below.
{
"date":"01-01-2014",
"details": [
{"name":"abc",
"address":{
"city":"abc" , "state":"abc"
},
{"name":"xyz",
"address":{
"city":"xyz" , "state":"xyz"
…
how to retrieve the value from the mongodb using springframe work , can anyone share the code or tell the procedure .
and how to put the values comes from the database store them in a csv file.
Thanks
Navneet