Search code examples
mongodbmongoosemongodb-querytingodb

Collection.find is not working properly


I am using TingoDB and it uses all Mongodb syntax. I have one collection where I am saving around 70K documents but when I run find query without any filter it returns only around 42K documents. I do not know what I am doing wrong.

Please find below code,

collection().find().count(function(err, c){
  console.log("count is: ",c);
  console.log("err is: ",err);
});

I also checked the file where records are saved and I am sure not all records are returning. Can somebody please help me out here.

TIA Mangesh


Solution

  • You can try following things 1. Check how many records are saved in DB. Is it 70k unique records in collection. 2. Run same query using DB Client. You can run similar query using any DB Client and check if same query returns similar records.