How does mongo join table queries?

  mongodb, question

There are two watches now.

/* Message System Model */
 information_model : {
 name : "information_model",
 cols : {
 INFO_ID: String, // message ID
 INFO_TITLE: String, // title
 INFO_CONTENT: String, // message content
 INFO_TIME: Date, // message time
 INFO_TYPE: String // Message Type (Message-1, Message-2, SMS-3, Status-4, Work-5)
 /* Message Status Model */
 information_state : {
 name : "information_state",
 cols : {
 INFO_ID: String, // message ID
 LOGIN_NAME: String, // user login name
 INFO_STATE: String, // state (unread-0, read-1)
 INFO_DELETE: String // delete (not deleted-0, deleted-1)

The two tables INFO_ID are the same.
Now you need to join the table query (that is, the return value includes all fields in information_model, and also includes INFO_STATE field in information_state). how should you operate?
The best example is mongoose, thank you. !

Mongoose can correlate data.

Information_model table plus oneinformation_state_infoAdded in Schema:

information_state_info: {type:ObjectId, ref: “information_state” , index: true}


infoModel.find().populate('information_state_info',"INFO_ID LOGIN_NAME INFO_STATE INFO_DELETE").sort({INFO_ID: 1}).exec next

The corresponding data will appear in your information_state_info.

But each data needs to store the corresponding id.