Initial commit
This commit is contained in:
21
node_modules/mongodb/lib/operations/find_one_and_delete.js
generated
vendored
Normal file
21
node_modules/mongodb/lib/operations/find_one_and_delete.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
const FindAndModifyOperation = require('./find_and_modify');
|
||||
|
||||
class FindOneAndDeleteOperation extends FindAndModifyOperation {
|
||||
constructor(collection, filter, options) {
|
||||
// Final options
|
||||
const finalOptions = Object.assign({}, options);
|
||||
finalOptions.fields = options.projection;
|
||||
finalOptions.remove = true;
|
||||
|
||||
// Basic validation
|
||||
if (filter == null || typeof filter !== 'object') {
|
||||
throw new TypeError('Filter parameter must be an object');
|
||||
}
|
||||
|
||||
super(collection, filter, finalOptions.sort, null, finalOptions);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = FindOneAndDeleteOperation;
|
||||
Reference in New Issue
Block a user