[SERVER-40397] Add the ability to specify a pipeline to the findAndModify command Created: 01/Apr/19  Updated: 29/Oct/23  Resolved: 01/May/19

Status: Closed
Project: Core Server
Component/s: Aggregation Framework, Write Ops
Affects Version/s: None
Fix Version/s: 4.1.11

Type: Improvement Priority: Major - P3
Reporter: Charlie Swanson Assignee: Charlie Swanson
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-40381 Add the ability to specify a pipeline... Closed
is depended on by DRIVERS-626 Add the ability to specify a pipeline... Closed
is depended on by SERVER-40419 Remove feature flag guard of pipeline... Closed
is depended on by SERVER-40399 Test support for 'collation' option i... Closed
is depended on by SERVER-40401 Test support for 'bypassDocumentValid... Closed
is depended on by SERVER-40403 Test support for 'writeConcern' optio... Closed
is depended on by SERVER-40404 Add support for 'fields' option in co... Closed
is depended on by SERVER-40405 Add support for 'sort' option in comb... Closed
is depended on by SERVER-40407 Add support for '$$NOW' and '$$CLUSTE... Closed
is depended on by SERVER-40408 Add pipeline versions of update helpe... Closed
is depended on by SERVER-40411 Add FSM workload(s) to stress write c... Closed
Documented
is documented by DOCS-12671 Docs for SERVER-40397: Add the abilit... Closed
Backwards Compatibility: Fully Compatible
Sprint: Query 2019-04-08, Query 2019-04-22, Query 2019-05-06
Participants:
Linked BF Score: 0

 Description   

The new syntax will look like this:

{
  findAndModify: <collection-name>,
  query: <document>,
  sort: <document>,
  remove: <boolean>,
  update: <document OR pipeline>,
  new: <boolean>,
  fields: <document>,
  upsert: <boolean>,
  bypassDocumentValidation: <boolean>,
  writeConcern: <document>,
  collation: <document>,
  arrayFilters: <array>
}

The only supported stages in a pipeline will be single-document transformations: $addFields, $project, and $replaceRoot. For this ticket, we will not support options such as collation, bypassDocumentValidation, upsert, sort, and fields. Those options will be tracked by separate work items. We will never support arrayFilters in the pipeline-style update.



 Comments   
Comment by Githook User [ 01/May/19 ]

Author:

{'name': 'Charlie Swanson', 'username': 'cswanson310', 'email': 'charlie.swanson@mongodb.com'}

Message: SERVER-40397 Fix fle_findandmodify.js
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/3eca0341fb8e6390033090401d3422264934fa53

Comment by Githook User [ 01/May/19 ]

Author:

{'email': 'charlie.swanson@mongodb.com', 'name': 'Charlie Swanson', 'username': 'cswanson310'}

Message: SERVER-40397 Add pipeline updates to findAndModify

Adds the ability to specify an array representing an aggregation
pipeline to the 'udpate' argument of findAndModify. Certain options like
'sort' and 'fields' are not yet supported.
Branch: master
https://github.com/mongodb/mongo/commit/7e4fe022c0d1542519f613d5e718a11e958a31c1

Comment by Githook User [ 01/May/19 ]

Author:

{'email': 'charlie.swanson@mongodb.com', 'name': 'Charlie Swanson', 'username': 'cswanson310'}

Message: SERVER-40397 Clean up FLE findAndModify test
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/6127326ccd131205ad96aa4a7483ff804b97be8f

Comment by Githook User [ 01/May/19 ]

Author:

{'email': 'charlie.swanson@mongodb.com', 'name': 'Charlie Swanson', 'username': 'cswanson310'}

Message: SERVER-40397 Add pipeline updates to findAndModify

Adds the ability to specify an array representing an aggregation
pipeline to the 'udpate' argument of findAndModify. Certain options like
'sort' and 'fields' are not yet supported.
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/5136aa231ffa7fb0ca8550e1aab8d85e89c72936

Comment by Charlie Swanson [ 01/Apr/19 ]

This work should be gated behind a feature-flag like we did for wildcard indexes until we're ready to release it. Filed SERVER-40419 to track turning this on by default.

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