how to make manual refreces, or inner joins in mongodb using java query

622 views
Skip to first unread message

Navneet Mathpal

unread,
Mar 13, 2014, 2:06:35 AM3/13/14
to mongod...@googlegroups.com
Hi,

As we make inner joins in sql , primary id of one table is refrence id of another table
ex:-
SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate
FROM Orders
INNER JOIN Customers
ON Orders.CustomerID=Customers.CustomerID;

so we can combine the result of two tables.
now I am using spring frame work and mongo db as my data base, how can i implement join in mongodb.

Happy coding
Navneet Mathpal

Russell Bateman

unread,
Mar 13, 2014, 9:01:48 AM3/13/14
to mongodb-user
Navneet,

Welcome to the wonderful world of MongoDB. Keep your former database experience and understanding, but leave your SQL preconceptions at the door. You can't perform joins between collections (tables) in that way in MongoDB. You need to rethink what you're trying to do a little bit. Here's a link to get started:

http://docs.mongodb.org/manual/reference/sql-comparison/

As you have specific questions on your many-to-one, one-to-many, etc. relationships, come back and ask in this forum.

Hope this helps.


--
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb

---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Navneet Mathpal

unread,
Mar 13, 2014, 9:35:05 AM3/13/14
to mongod...@googlegroups.com
Hi Russell,
        can you help me in this.
 

Russell Bateman

unread,
Mar 13, 2014, 9:52:23 AM3/13/14
to mongodb-user
This is in reference to your other post in this forum dealing with comparing time and date in Java as retrieved in documents from MongoDB? I would advise you to be patient; someone will surely answer. Another possibility would be to repost in stackoverflow.com.

Russ


--

William Zola

unread,
Mar 13, 2014, 11:22:20 AM3/13/14
to mongod...@googlegroups.com
Hi Navneet!

In MongoDB, you need to perform application-level joins: the database cluster will not do it for you.  

This is pretty straightforward: see here for an example:

 -William 
Reply all
Reply to author
Forward
0 new messages