One-to-Big Relationship: Getting Documents with One Request

Returning to the classic mongodb example (messages and users):

Posts:

{title: "Greetings", body:"Hello world", userId:12345} 

Users

 {_id:12345, name:"John Smith", email: john@smith.org "} 

How to get a message

 {title: "Greetings", body:"Hello world", <username>:"John Smith"} 

with sigle request?

+4
source share
1 answer

MongoDB is not an RDBMS - therefore NO CONNECTIONS - either you use two queries, or you use an attachment, or see "database links".

+3
source

Source: https://habr.com/ru/post/1338088/


All Articles