[DRIVERS-141] Prohibit find() with no selector in Bulk API Created: 18/Feb/14  Updated: 15/Apr/19  Resolved: 11/Nov/15

Status: Closed
Project: Drivers
Component/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: Barrie Segal
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on CXX-20 Implement full support for write comm... Closed
Related
is related to CSHARP-911 Prohibit find() with no selector in B... Closed
is related to JAVA-1116 Prohibit find() with no selector in B... Closed
is related to NODE-129 Prohibit find() with no selector in B... Closed
is related to PYTHON-641 Prohibit find() with no selector in B... Closed
is related to RUBY-722 Prohibit find() with no selector in B... Closed
Driver Compliance:
Key Status/Resolution FixVersion
CXX-20 Done legacy-0.9.0

 Description   

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.



 Comments   
Comment by Andrew Morrow (Inactive) [ 03/Mar/15 ]

C++11 driver requires a bson view for find.

Generated at Thu Feb 08 08:20:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.