Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-156

Deleting a document withing collection is not done when using the document (sometimes)

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major - P3 Major - P3
    • None
    • 2.2
    • None
    • None
    • 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);

      Attachments

        Activity

          People

            eliot Eliot Horowitz (Inactive)
            moammo59 Amir Moulavi
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: