[JAVA-156] Deleting a document withing collection is not done when using the document (sometimes) Created: 27/Aug/10  Updated: 29/Oct/10  Resolved: 27/Aug/10

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: 2.2
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Amir Moulavi Assignee: Eliot Horowitz (Inactive)
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows, Linux



 Description   

Consider that we have a document with some fields. If I try to delete like below, it can happen sometimes that it is not deleted in some occasions without returning any exception and/or WriteResult error:

DBObject q = new BasicDBObjectBuilder().start().add("_id", new ObjectId(id)).get();
DBCursor res = mongoDBConnector.getContacts().find(q);
if (res.hasNext())

{ mongoDBConnector.getContacts().remove(res.next()); }

However, I can delete successfully by using the field _id of the document like below:

DBObject q = new BasicDBObjectBuilder().start().add("_id", new ObjectId(id)).get();
mongoDBConnector.getContacts().remove(q);



 Comments   
Comment by Amir Moulavi [ 27/Aug/10 ]

Unfortunately I can not attach any source since I am not allowed. But
here comes another interesting info. I tested on both windows and Linux
and the problem only occurred when the target DB is on Linux. So I think it
has nothing to do with the driver.

Comment by Tony Hannan [ 27/Aug/10 ]

Can't reproduce. Waiting for clarification from Reporter.

Comment by Eliot Horowitz (Inactive) [ 27/Aug/10 ]

Your example works perfectly for me.

If you can send an entire java program that shows the problem, I can investigate further.

Generated at Thu Feb 08 08:51:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.