[JAVA-4549] Some Document Can Not Be Found By Mongo Java Client Created: 25/Mar/22 Updated: 27/Oct/23 Resolved: 28/Mar/22 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Unknown |
| Reporter: | 仲鲍 杨 | Assignee: | Ross Lawley |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | external-user | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
SummarySome Document Can Not Be Found By Mongo Java Clinet。 client version:4.5.1 server version: 4.2.5 Java Code: ``` return count is :588177 Query Ql In Tool:NoSQLBooster for MongoDB ``` return count is :588178
Then I Find The Lose Document is ``` The I just find Document By ObjectId By Java Mongo Driver , But Still Not Find Id; Java Code is below ```
|
| Comments |
| Comment by Ross Lawley [ 28/Mar/22 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
Glad you found the cause of the issue! Closing this ticket. All the best, Ross | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by 仲鲍 杨 [ 28/Mar/22 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
I'm so sorry that it a Oolong! the java dirver connect mongodb is an backup mongodb,but NoSQLBooster connect's Mongo is a Productive MongoDB..... when i change java driver mongo db the count is then same between NoSQLBooster and mongo java dirver | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by 仲鲍 杨 [ 28/Mar/22 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
I'm so Soryy ,that i can not provide you a minimal reproducible example now. but i find that go mongo driver can find a real count. | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ross Lawley [ 25/Mar/22 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks - checking out "NoSQLBooster" it uses the node driver underneath - so I wouldn't expect to find any differences in the results between that and the shell, the java driver and pymongo. As they all follow the same specifications and run the specification test suite. One thing to note is the example document has _id as a string value and not an ObjectId - so that is something I would double check. eg:
When testing locally on MongoDB 4.2 using the shell I didn't see any issues:
I think to take this further I'd need to be able to reproduce the issue. Ideally, I'd ask for a minimal reproducible example as that would help as I could then replicate the issue and potentially use it to find if there is a bug. All the best, Ross | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by 仲鲍 杨 [ 25/Mar/22 ] | |||||||||||||||||||||||||||||||||||||||||||||||
| { "_id": "62388633f12eb410f0e6d922", "account_id": 1041152, "amount_after": 2547356, "currency_type": 3, "delta": 150, "description": "", "io": 2, "reason": 0, "role_id": 4552713003, "role_level": 2711, "role_name": "ToXicYBLYUDOK", "role_type": 2823000001, "server": 3006, "sex": 2802000019, "stime": "20220321.220539", "time": 1647871539, "urs": "121025659" } | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by 仲鲍 杨 [ 25/Mar/22 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
I have export the some collectiion from mongo by mongoexport then load them to an analysis system. after finish the process of data load. i write a code support by java mongo dirver to check the data between mongo and analysis system.then find some data count is diff.
| |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ross Lawley [ 25/Mar/22 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
Can you output the full document ? Many thinks, Ross | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by 仲鲍 杨 [ 25/Mar/22 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
I have try mongo shell、mongo java driver、pymongo,all of them can not find the document who's ObjectId is 62388633f12eb410f0e6d922,Only NoSQLBooster for MongoDB can find this document | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ross Lawley [ 25/Mar/22 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks onemail1876@gmail.com, So only "NoSQLBooster for MongoDB" returns a different count? I could possibly understand a difference in the count value - as countDocuments uses the aggregation framework for the count. See the documentation on count where as the legacy count method used the temporary metadata to provide results - but I wouldn't expect that to be the case using a standalone mongodb. countDocuments was added in Can you confirm that "NoSQLBooster for MongoDB" can find the document with the ObjectId("62388633f12eb410f0e6d922"), where as all other drivers / the shell cannot? Other things to be aware of are the latest version of MongoDB is 5.0.6 and the latest MongoDB 4.2 version is 4.2.19 - I don't think that is related but its more for your information. Many thanks, Ross | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by 仲鲍 杨 [ 25/Mar/22 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
The Result Of Mongo Shell is the same with mongo java dirver.The I use pymongo get the same result with mongo java driver. the toplogy of the mongo db is standalone mongodb | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ross Lawley [ 25/Mar/22 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
Thank you for the ticket. In order to understand the cause more, can I ask you to confirm the count using the mongo shell? Secondly, can you provide more information on the toplogy you are using eg: standalone mongodb, replicaset, sharded cluster, sharded replicaset cluster. Many thanks, Ross |