我有 2 个集合:文档和类型。在文档中我有文档:
{
'_id': ObjectId('0000'),
'name': 'someName',
'type': ObjectId('1111') // id i have
}
在类型中:
{
'_id': ObjectId('2222'),
'for': 'Docs',
'types': [
{
'_id': ObjectId('1111'), // type i need
'name': 'someType' // want to get this name
}
// , and so on
]
}
在Docs.findOne({_id: '0000'})
我拥有type = ObjectId('1111')
('someType'的id)之后。获取 someType 的名称值的最佳方法是什么?