2

Can someone give me an example of comparing the data of two collections.

I have two collections called A and B. B having foreign key reference of A's _id. Please find below:

A:

{
        "_id" : ObjectId("543e4eed974ed51b8ee1821d"),
        "name" : "Technotip",
        "product" : "video tutorial",
        "emp" : [
                "Sathish",
                "Kiran"
        ],
        "videos" : [
                {
                        "mongo" : "mongo videos",
                        "php" : "php videos"
                }
        ]
}

B:

{
        "_id" : ObjectId("543e4fc3974ed51b8ee1821e"),
        "name" : "Stathish",
        "company_id" : ObjectId("543e4eed974ed51b8ee1821d")
}

Can someone please help me to find equivalent values from both collections using joins?

arco444
  • 22,002
  • 12
  • 63
  • 67
haripriya
  • 21
  • 1
  • MongoDB doesn't support joins. Can you clarify what you're looking for? – JohnnyHK Oct 16 '14 at 12:58
  • i just want to compare equal values from both collection in a singl result – haripriya Oct 16 '14 at 13:13
  • I don't understand what you mean by "compare equal values." Can you edit your question to include the output you're expecting from the query? – JohnnyHK Oct 16 '14 at 13:15
  • i have something related to my question. http://stackoverflow.com/questions/9240636/how-to-compare-2-mongodb-collections . – haripriya Oct 16 '14 at 13:15
  • i want to validate the data from the collection A which is available in any other collections. for example, i have name of employee called "radha" from employee collection whose id is also available in department collection. like db.test1 == db.test2 – haripriya Oct 16 '14 at 13:40

0 Answers0