Nodejs association query

  node.js, question

Node novice asked a question.
I am working on a microblog system. mongodb inside has inserted two documents: user and article. user saves user information and article saves article information.
The following figure!
图片描述

图片描述

The uid of the user cannot be changed, and the name can be changed, so only the uid of the author is stored in the article document, and the name is not stored.
Then the question arises, how can I find out the author’s name when querying this article? Thank you for your help.

Mongo, a Hibari, encourages you to spell the results with multiple queries. First find out the record of the article, then take out the uid value, and go to the user collection inside to find out the user information. Of course, if you don’t set uid as the primary key, you can build an index for uid.