|
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:
|
collection.initializeOrderedBulkOp().find()
|
collection.initializeUnorderedBulkOp().find()
|
Calling find() with an empty selector is fine:
collection.initializeOrderedBulkOp().find({})
|
Justification
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.
|