-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Component/s: None
-
None
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.
- depends on
-
CXX-20 Implement full support for write commands
- Closed
- is related to
-
CSHARP-911 Prohibit find() with no selector in Bulk API
- Closed
-
JAVA-1116 Prohibit find() with no selector in Bulk API
- Closed
-
NODE-129 Prohibit find() with no selector in Bulk API
- Closed
-
PYTHON-641 Prohibit find() with no selector in Bulk API
- Closed
-
RUBY-722 Prohibit find() with no selector in Bulk API
- Closed