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

gridFs.remove((DBObject)null) removes all elements from bucket

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.12.0, 3.0.0
    • Affects Version/s: 2.11.2
    • Component/s: GridFS
    • None
    • Environment:
      java version "1.7.0_25"
      Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
      Java HotSpot(TM) Client VM (build 23.25-b01, mixed mode, sharing)
      Mongodb version: 2.0.6
      Java driver version: 2.11.2

      When passing null to GridFS.remove(DBObject dbobject) all files of the current bucket are removed. This is inconsistent compared to the other remove() methods of GridFS:

      gridFs.remove((String)null); // nothing happens
      gridFs.remove((ObjectId)null); // nothing happens
      gridFs.remove((DBObject)null); // all files from bucket are removed

      If this is intended behavior it should be documented in the javadoc comment.

        1. Main.java
          0.9 kB
          Micha S.

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            micha Micha S.
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: