document count for each collection As you can see, the number of documents is 3. When I click the collection though. I see only 2 documents. collection view with less documents I even used mongo shell and I got the same count. mongosh output of document count
When I use mongo shell command db.call_logs.find(), all three are printed. Why is it not available on mongodb atlas and also when I query it on my nodejs application.
CodePudding user response:
When I click the collection though. I see only 2 documents.
Why is it not available on mongodb atlas
You've shared with us a small screenshot to demonstrate the discrepancy that seems to be from the Atlas UI. Based on that, I suspect that the behavior that you are observing may be what is documented here:
The Atlas UI limits the total byte size of documents shown per page. As a result, you may see varying numbers of documents per page, especially if your documents vary significantly in size.
From your first screenshot we can see that the logical data size of the call_logs
collection is 14MB
, meaning that the average size of the 3 documents is close to 5MB
. It seems that your callLogs
array field may contain a significant amount of data. Therefore the UI is probably hitting the display size threshold after just 2 documents resulting in the behavior that you are observing.
If you remove that callLogs
field from the results returned to the UI (by projecting it out) then it may display all 3 documents. In any case, the data is not missing from the collection it is simply not being displayed all at once.
Why is it not available ... when I query it on my nodejs application.
Have you observed the data not being available in the nodejs application? I don't think there is any evidence of this anywhere in your question.
As an aside, MongoDB documents have a strict size limit of 16MB. You may wish to review (and potentially modify) your schema to ensure that you don't run into this limit at some point in the future.