1

I have two collections Basic_aminities and Building. I want the building name via basic_aminities collections.

Basic_aminities:

{ "_id" : "BA1", 
"Property_id" : "B1", 
"hospital " : "5 km", 
"bahn_station" : "6 km ",
"restaurant" : "4 km",
"University" : "20 km",
"police_station" : "8 km",
"Airport" : "40 km",
"city_center" : " 5 km" }  

Building collection:

{ "_id" : "B1", 
"Sale_type" : "Rental", 
"Building_name" : "swamy", }  

Here is my query which I tried to connect two collections in mongoDB. I need the building_name via the collection basic_aminities:

db.Basic_aminities.find({ Property_id : {$exists: true}, 
                          Property_id.B1 : Building_name }) 

Can anyone please tell me how to write query?

JohnnyHK
  • 305,182
  • 66
  • 621
  • 471
sreekanth
  • 21
  • 1
  • 1
    Hello, as I presume you are a new user, please read the guidelines before asking for assistance. First of all, you should properly edit your code and you should not be expecting people to be offering a free answer without you previously trying to solve the problem yourself. – vladzam Feb 01 '15 at 00:28
  • Hello, I am new to Mongo DB. here is my query which i tried to connect two collections in mongoDB. I need the building_name via the collection basic_aminities db.Basic_aminities.find({ Property_id : {$exists: true}, Property_id.B1 : Building_name }) can anyone please tell me how to do that. – sreekanth Feb 01 '15 at 00:55

0 Answers0