Get two result sets in a single call I'm working on an eCommerce-based website using MongoDb.

In my DBCollection I have two types of documents:


Company details Item

{ doc_type : 'company',
  name : 'Acer',
  type : 'Laptops',
  helpline : '1800-200-000'
}

Item Details

{doc_type : "item",
  item_id : 1001,
  price : 2000,
  discount : 20}



Now in the product page I need to get data from both documents. 

So, first I run

db.collection.find({doc_type:'item', item_id : 1001 });


to show product data, and then 

 db.collection.find({doc_type:'company', name: "Acer"});


to get company data.

Is there any way to reduce these two calls to one and get data in a single result set?
If both documents are in the same collection, then yes you can - using the $or operator.

db.collection.find({
  $or: [
    {doc_type:'item', item_id : 1001},
    {doc_type:'company', name: "Acer"}
  ]
});


That will return both documents:

{ doc_type : 'company',
  name : 'Acer',
  type : 'Laptops',
  helpline : '1800-200-000'
}
{ doc_type : "item",
  item_id : 1001,
  price : 2000,
  discount : 20}
}


However, if you have two different types of record then it is probably best to store them in different collections.