You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
683 B
26 lines
683 B
5 years ago
|
'use strict';
|
||
|
|
||
|
const OperationBase = require('./operation').OperationBase;
|
||
|
const deleteCallback = require('./common_functions').deleteCallback;
|
||
|
const removeDocuments = require('./common_functions').removeDocuments;
|
||
|
|
||
|
class DeleteManyOperation extends OperationBase {
|
||
|
constructor(collection, filter, options) {
|
||
|
super(options);
|
||
|
|
||
|
this.collection = collection;
|
||
|
this.filter = filter;
|
||
|
}
|
||
|
|
||
|
execute(callback) {
|
||
|
const coll = this.collection;
|
||
|
const filter = this.filter;
|
||
|
const options = this.options;
|
||
|
|
||
|
options.single = false;
|
||
|
removeDocuments(coll, filter, options, (err, r) => deleteCallback(err, r, callback));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = DeleteManyOperation;
|