我有一个集合,其中的数据符合几种不同模式之一。这些都在一个集合中的原因是,我需要能够利用MongoDB的无模式本质来一起查询它们。
有没有一种方法可以在忽略模式的情况下用猫鼬查询集合?例如:
var adam = new ContractCustomer({
// Contract customer data saved to customers collection
})
var betty = new PaygCustomer({
// PAYG customer data saved to customers collection
})
adam.save()
betty.save()
Customers.find({}).exec().then() // Query all the customers regardless of which schema they belong to.
答案 0 :(得分:0)