@@ -23,8 +23,6 @@ export interface FindAndModifyOptions extends CommandOperationOptions {
23
23
upsert ?: boolean ;
24
24
/** Limits the fields to return for all matching documents. */
25
25
projection ?: Document ;
26
- /** @deprecated use `projection` instead */
27
- fields ?: Document ;
28
26
/** Determines which document the operation modifies if the query selects multiple documents. */
29
27
sort ?: Sort ;
30
28
/** Optional list of array filters referenced in filtered positional operators */
@@ -88,10 +86,8 @@ export class FindAndModifyOperation extends CommandOperation<Document> {
88
86
cmd . remove = options . remove ? true : false ;
89
87
cmd . upsert = options . upsert ? true : false ;
90
88
91
- const projection = options . projection || options . fields ;
92
-
93
- if ( projection ) {
94
- cmd . fields = projection ;
89
+ if ( options . projection ) {
90
+ cmd . fields = options . projection ;
95
91
}
96
92
97
93
if ( options . arrayFilters ) {
@@ -162,7 +158,6 @@ export class FindOneAndDeleteOperation extends FindAndModifyOperation {
162
158
constructor ( collection : Collection , filter : Document , options : FindAndModifyOptions ) {
163
159
// Final options
164
160
const finalOptions = Object . assign ( { } , options ) ;
165
- finalOptions . fields = options . projection ;
166
161
finalOptions . remove = true ;
167
162
168
163
// Basic validation
@@ -184,7 +179,6 @@ export class FindOneAndReplaceOperation extends FindAndModifyOperation {
184
179
) {
185
180
// Final options
186
181
const finalOptions = Object . assign ( { } , options ) ;
187
- finalOptions . fields = options . projection ;
188
182
finalOptions . update = true ;
189
183
finalOptions . new = options . returnOriginal !== void 0 ? ! options . returnOriginal : false ;
190
184
finalOptions . upsert = options . upsert !== void 0 ? ! ! options . upsert : false ;
@@ -215,7 +209,6 @@ export class FindOneAndUpdateOperation extends FindAndModifyOperation {
215
209
) {
216
210
// Final options
217
211
const finalOptions = Object . assign ( { } , options ) ;
218
- finalOptions . fields = options . projection ;
219
212
finalOptions . update = true ;
220
213
finalOptions . new =
221
214
typeof options . returnOriginal === 'boolean' ? ! options . returnOriginal : false ;
0 commit comments