[SERVER-8120] mongoexport and count command return different number of records Created: 09/Jan/13  Updated: 10/Dec/14  Resolved: 28/Oct/13

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.0.4
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Lynn Hsu Assignee: Unassigned
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux 64bit
Linux 2.6.32-220.7.1.el6.x86_64 #1 SMP Wed Mar 7 00:52:02 GMT 2012 x
86_64 x86_64 x86_64 GNU/Linux


Operating System: Linux
Participants:

 Description   

We are using mongo shell 2.0.4

We have see something really strange in our mongo collection, which holding roughly 46 million records.

When we do "db.CollectionOne.count()" through either mongo shell or java driver, we get 46 million records. However, when we use mongoexport, mongodump to dump ALL the records out, it will have only 43 million records. We even tried the java driver to have a cursor to write out all the records in the db collection, the result is still 43 million, not 46 million.
The count command shows the result below:
PRIMARY> db.CollectionOne.count()
46676257

The mongoexport shows the result below. (mongodump shows the same amount of number as mongoexport 43309967)
connected to: 127.0.0.1
exported 43309967 records
EXPORTING FROM MONGODB IS DONE

Our mongodb version is 2.0.4 and it is not a shard mongo. It is a replicate set only. The primary has two other replicate member in its group.

Did anyone have experienced something like this before? Any suggestion will be very appreciated.

Thanks



 Comments   
Comment by Stennie Steneker (Inactive) [ 28/Oct/13 ]

Hi Lynn,

I'm closing this issue due to inactivity.

If you are still seeing this issue (particularly with a newer version of MongoDB, such as 2.4.x) please feel free to open a new issue or comment on this one with the relevant details.

Thanks,
Stephen

Comment by Eliot Horowitz (Inactive) [ 10/Jan/13 ]

Can you try mongodump with the --forceTableScan option?

Comment by Lynn Hsu [ 09/Jan/13 ]

have one minor correction here. The 46 million is through mongo shell count command only, not the java driver. The java driver report the same amount as the mongexport and mongodump

Generated at Thu Feb 08 03:16:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.