description: client bulkWrite updateOne-sort schemaVersion: "1.4" runOnRequirements: - minServerVersion: "8.0" serverless: forbid # Serverless does not support bulkWrite: CLOUDP-256344. createEntities: - client: id: &client0 client0 observeEvents: - commandStartedEvent - commandSucceededEvent - database: id: &database0 database0 client: *client0 databaseName: &database0Name crud-tests - collection: id: &collection0 collection0 database: *database0 collectionName: &collection0Name coll0 initialData: - collectionName: *collection0Name databaseName: *database0Name documents: - { _id: 1, x: 11 } - { _id: 2, x: 22 } - { _id: 3, x: 33 } _yamlAnchors: namespace: &namespace "crud-tests.coll0" tests: - description: client bulkWrite replaceOne with sort option operations: - object: *client0 name: clientBulkWrite arguments: models: - replaceOne: namespace: *namespace filter: { _id: { $gt: 1 } } sort: { _id: -1 } replacement: { x: 1 } expectEvents: - client: *client0 events: - commandStartedEvent: commandName: bulkWrite databaseName: admin command: bulkWrite: 1 ops: - update: 0 filter: { _id: { $gt: 1 } } updateMods: { x: 1 } sort: { _id: -1 } multi: { $$unsetOrMatches: false } upsert: { $$unsetOrMatches: false } nsInfo: - ns: *namespace - commandSucceededEvent: reply: ok: 1 nErrors: 0 nMatched: 1 nModified: 1 commandName: bulkWrite outcome: - collectionName: *collection0Name databaseName: *database0Name documents: - { _id: 1, x: 11 } - { _id: 2, x: 22 } - { _id: 3, x: 1 }