Answer the question
In order to leave comments, you need to log in
Is data communication between databases possible in MongoDB?
Good time of the day. Don't take it as a stupid question, but whatever. On the mongodb server, I created several databases:
1) todos (used to store tasks) 2) users (used to store user data)
The todos database has a collection of tasks in the document, the owner field is stored which I need to identify the user who created the task. At the same time, a collection with a document containing the ObjectId("56c658bbcdc91848503259f5") field is stored in the users database. How can I link these two databases together so that when I search, I can find all the tasks of the user ObjectId("56c658bbcdc91848503259f5") I get all the documents from the todos database that the user created with this id? Thanks in advance for your replies. I myself understand that I'm a fool, but I just started learning mongo with a node :)
Answer the question
In order to leave comments, you need to log in
in order to find all the tasks of the user ObjectId("56c658bbcdc91848503259f5") with a search query, should I display all the documents from the todos database that the user created with this id? Thanks in advance for your replies
That's why take a NoSQL database, and then ask how to do things typical for relational databases here.
Connections are necessary - take some postgresql. Or change the scheme and store tasks together with the user in 1 document. Why use the tool for other purposes?
But if you are already impatient, then read here . I don’t know if there are joins at the DB level in Mongo, but if so, they can be done programmatically in 2 queries.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question