Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
checkForIdAndData(object, function(error, foundObject) {
if (error) {
return callback(error)
}
if (overwrite) {
updatedObject = Object.assign({}, object)
} else {
updatedObject = Object.assign({}, foundObject, object)
}
var query = {}
var copy = Object.assign({}, updatedObject)
query[options.idProperty] = id
data = Mingo.remove(data, query)
data.push(updatedObject)
self.emit('afterUpdate', copy, overwrite)
callback(undefined, copy)
})
}
function deleteMany(query, callback) {
callback = callback || emptyFn
self.emit('deleteMany', query)
data = Mingo.remove(data, query)
self.emit('afterDeleteMany', query)
callback()
}