你的MongoDB集合中可以有这样的关系。如果使用Mongoose,可以在模式中定义它们,如下所示:
customerId:{{ type: mongoose.Schema.ObjectId, ref: 'user' }}
你可以通过 mongoose populate . 有关详细信息,请参见
mongoose populate
https://mongoosejs.com/docs/populate.html