top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How we use database Refernce in mongoDB by java code?

0 votes
293 views

db.Job.insert({"job_Title" : "Website", "job_Location" : "Kolkata", "salary" : "40000", "company" : "ROHIT", "department" : { "$ref": "department", "$id": ObjectId("579302282d180c1b80be65ec"), "$db": "test"}, "status":"Act"})
var job = db.Job.findOne({"company":"LOKI"})
var dep = job.department db[dep.$ref].findOne({"_id":(dep.$id)})

How we write this mongoDB shell query in Java program for insert and find Document?

posted Jul 25, 2016 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
0 votes

My collection is like this, but I want to update a nested object with {"env":"qa"} in my updated collection with java-driver:

{ "_id" : ObjectId("5b052eeff9290437b217b1ed"), "app" : "hike", "group" : [ { "env" : "prod" }, { "env" : "test" } ]}{ "_id" : ObjectId("5b052f36f9290437b217b1ee"), "app" : "viber", "group" : [ { "env" : "prod" }, { "env" : "test" } ]}

+1 vote

I want learn mongodb java and I want to do project in this area, I want to store encrypted data in the database.
Also I want to know what is mongoid gem. Please suggest some pointers?

+1 vote

I have a Created a Mongo Document inserted successfully to the Collection ~ "urldetls" which has 12 specific Unique keys with data in the values.

Spec: Mongodb 3.x, Java 1.7,

Question: I would like to retrieve the full document based on the value searched within all of the documents.
Problem: I cannot retrieve the document based on the key of the document.

How can i retrieve? I would like to use the Mongodb API 3.x version using java .

0 votes

I have been using morphia (object-storage mapper based on mongo java driver) for quite a while and I am satisfied with it but I would welcome also asynchronous version. I think it seem pretty straightforward as there is already asynchronous java driver. Do you know if something is planned or maybe if there is another option besides morphia?

...