[DRIVERS-347] Support deprecated "modifiers" FindOption in CRUD API Created: 09/Jan/17  Updated: 30/Oct/19  Resolved: 30/Oct/19

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

Type: Task Priority: Major - P3
Reporter: Jeremy Mikola Assignee: Unassigned
Resolution: Done Votes: 0
Labels: spec-change
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on CDRIVER-1522 Add mongoc_collection_find_with_opts Closed
depends on CSHARP-1896 Support deprecated "modifiers" FindOp... Closed
depends on JAVA-2427 Deprecate modifiers in FindOptions an... Closed
depends on PYTHON-1217 Support all find command options as n... Closed
depends on RUBY-1195 Support deprecated "modifiers" FindOp... Closed
depends on CXX-1195 Support deprecated "modifiers" FindOp... Closed
depends on PHPLIB-255 Support deprecated "modifiers" FindOp... Closed
depends on NODE-911 Support deprecated "modifiers" FindOp... Closed
Related
is related to DRIVERS-348 Resync CRUD spec tests organized by m... Closed
Driver Compliance:
Key Status/Resolution FixVersion
CDRIVER-1522 Done 1.5.0
CSHARP-1896 Done 2.10.0
RUBY-1195 Works as Designed
PYTHON-1217 Done 3.5
CXX-1195 Done 3.2.0-rc0
JAVA-2427 Done 3.5.0
PERL-718 Done 2.0.0
NODE-911 Works as Designed
SCALA-291 Done 2.2.0
PHPLIB-255 Done 1.1.0

 Description   

The CRUD specification now states:

Q: Where did modifiers go in FindOptions?
MongoDB 3.2 introduced the find command. As opposed to using the general "modifiers" field any longer, each relevant option is listed explicitly. Some options, such as "tailable" or "singleBatch" are not listed as they are derived from other fields. Upgrading a driver should be a simple procedure of deprecating the "modifiers" field and introducing the new fields. When a collision occurs, the explicitly specified field should override the value in "modifiers".

Drivers still supporting a "modifiers" option for find() should only fall back to values in that document if the first-class option is not specified. This snippet from the PHP driver may serve as an example.

  • "comment" option falls back to "$comment" modifier option
  • "hint" option falls back to "$hint" modifier option
  • "max" option falls back to "$max" modifier option
  • "maxScan" option falls back to "$maxScan" modifier option
  • "maxTimeMS" option falls back to "$maxTimeMS" modifier option
  • "min" option falls back to "$min" modifier option
  • "returnKey" option falls back to "$returnKey" modifier option
  • "showRecordId" option falls back to "$showDiskLoc" modifier option
  • "sort" option falls back to "$orderby" modifier option
  • "snapshot" option falls back to "$snapshot" modifier option

The CRUD spec does not dictate an "explain" option for find(); however, drivers should ensure that the "$explain" modifier is still supported for legacy queries (i.e. not using the find command).



 Comments   
Comment by J Rassi [ 27/Jan/17 ]

Relatedly, should drivers be upconverting requests like find().modifiers({$orderby: {a: 1}}) to their find command equivalents, when the server has find command support?

Comment by J Rassi [ 27/Jan/17 ]

Should we add spec tests to validate correctness for this logic?

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