不使用ref属性的两个集合Join方法

时间:2019-07-10 23:34:07

标签: node.js mongodb express mongoose

我想知道如何从不具有'ref'属性的两个集合中获取数据。

我的猫鼬模式如下:

let Person = new Schema({
    "NO": Number,
    "OrgId": String, //Org collection's _id
    "Birthday": String,
     ... ...
    }

let Org = new Schema({
  org_no: {
    type: Number
  },
  org_name: {
    type: String
  },
{
    collection: 'orgs'
});

module.exports = mongoose.model('Orgs', Org); 

我想获取诸如:

之类的数据
{
 'NO' : '1',
 'OrgId': '129718273dufisjdf82374jij23j', // == Org collection's _id
 'Birthday': '10/07/2019',
 'org_name': 'adidas'
}

希望大家能给予帮助!

0 个答案:

没有答案
相关问题