Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-141

Prohibit find() with no selector in Bulk API

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Component/s: None
    • Labels:
    • $i18n.getText("admin.common.words.hide")
      Key Status/Resolution FixVersion
      CXX-20 Done legacy-0.9.0
      #scriptField, #scriptField *{ border: 1px solid black; } #scriptField{ border-collapse: collapse; } #scriptField td { text-align: center; /* Center-align text in table cells */ } #scriptField td.key { text-align: left; /* Left-align text in the Key column */ } #scriptField a { text-decoration: none; /* Remove underlines from links */ border: none; /* Remove border from links */ } /* Add green background color to cells with FixVersion */ #scriptField td.hasFixVersion { background-color: #00FF00; /* Green color code */ } /* Center-align the first row headers */ #scriptField th { text-align: center; } Key Status/Resolution FixVersion CXX-20 Done legacy-0.9.0

      There's been a clarification to the spec: The Bulk API's find() method requires a selector. (Also known as a "query" or a "spec".) It should immediately raise the appropriate compile error or runtime exception if called like:

      // Prohibited:

      Calling find() with an empty selector is fine:



      We're updating APIs to follow these principles:

      1. Keep allowing users to read documents without specifying a query: find().
      2. Require users to specify a query when updating or removing documents. remove() is prohibited.
      3. The empty query "{}" counts as a query. remove({}) is ok.

      For example, in SERVER-12409 we prohibit collection.remove() in the shell. collection.remove({}) is still ok, because the user has expressed a desire to deliberately remove all documents.

      Fluent and Bulk API specifications have been updated to match these principles.

            barrie Barrie Segal
            jesse@mongodb.com A. Jesse Jiryu Davis
            0 Vote for this issue
            3 Start watching this issue