|
1 | 1 | import { ReadPreference } from '../read_preference';
|
2 |
| -import { |
3 |
| - maxWireVersion, |
4 |
| - applyRetryableWrites, |
5 |
| - decorateWithCollation, |
6 |
| - hasAtomicOperators, |
7 |
| - Callback |
8 |
| -} from '../utils'; |
| 2 | +import { maxWireVersion, decorateWithCollation, hasAtomicOperators, Callback } from '../utils'; |
9 | 3 | import { MongoError } from '../error';
|
10 | 4 | import { CommandOperation, CommandOperationOptions } from './command';
|
11 | 5 | import { defineAspects, Aspect } from './operation';
|
@@ -79,7 +73,6 @@ interface FindAndModifyOptions extends CommandOperationOptions {
|
79 | 73 | hint?: Document;
|
80 | 74 |
|
81 | 75 | // NOTE: These types are a misuse of options, can we think of a way to remove them?
|
82 |
| - update?: boolean; |
83 | 76 | remove?: boolean;
|
84 | 77 | new?: boolean;
|
85 | 78 | }
|
@@ -116,7 +109,7 @@ export class FindAndModifyOperation extends CommandOperation<Document> {
|
116 | 109 | const query = this.query;
|
117 | 110 | const sort = formatSort(this.sort);
|
118 | 111 | const doc = this.doc;
|
119 |
| - let options = { ...this.options, ...this.bsonOptions }; |
| 112 | + const options = { ...this.options, ...this.bsonOptions }; |
120 | 113 |
|
121 | 114 | // Create findAndModify command object
|
122 | 115 | const cmd: Document = {
|
@@ -148,12 +141,6 @@ export class FindAndModifyOperation extends CommandOperation<Document> {
|
148 | 141 | cmd.maxTimeMS = options.maxTimeMS;
|
149 | 142 | }
|
150 | 143 |
|
151 |
| - // No check on the documents |
152 |
| - options.checkKeys = false; |
153 |
| - |
154 |
| - // Final options for retryable writes |
155 |
| - options = applyRetryableWrites(options, coll.s.db); |
156 |
| - |
157 | 144 | // Decorate the findAndModify command with the write Concern
|
158 | 145 | if (options.writeConcern) {
|
159 | 146 | cmd.writeConcern = options.writeConcern;
|
@@ -225,7 +212,6 @@ export class FindOneAndReplaceOperation extends FindAndModifyOperation {
|
225 | 212 | ) {
|
226 | 213 | // Final options
|
227 | 214 | const finalOptions = Object.assign({}, options);
|
228 |
| - finalOptions.update = true; |
229 | 215 | finalOptions.new = options.returnOriginal !== void 0 ? !options.returnOriginal : false;
|
230 | 216 | finalOptions.upsert = options.upsert !== void 0 ? !!options.upsert : false;
|
231 | 217 |
|
@@ -255,7 +241,6 @@ export class FindOneAndUpdateOperation extends FindAndModifyOperation {
|
255 | 241 | ) {
|
256 | 242 | // Final options
|
257 | 243 | const finalOptions = Object.assign({}, options);
|
258 |
| - finalOptions.update = true; |
259 | 244 | finalOptions.new =
|
260 | 245 | typeof options.returnOriginal === 'boolean' ? !options.returnOriginal : false;
|
261 | 246 | finalOptions.upsert = typeof options.upsert === 'boolean' ? options.upsert : false;
|
|
0 commit comments