Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@syntropy/mongoose-document-versioner
Advanced tools
Force version to increment every time you update or save a mongoose document
This module sets a document version
key that is incremented
any time you save or update a document. This is useful for
detecting version conflicts.
Increments version
on the following pre
hooks:
findOneAndUpdate
updateOne
updateMany
update
save
Note: Model.findByIdAndUpdate()
calls the findOneAndUpdate
hook.
const versionerPlugin = require('mongoose-document-versioner');
const schema = new mongoose.Schema({ /* .... */ });
schema.plugin(versionerPlugin);
const Model = mongoose.model('Model', schema);
/* EXAMPLES */
Model.update({attr: 'foo'}, {attr: 'bar'}, {multi: true});
/*
* mongo query:
* model.update(
* { attr: 'foo' },
* { '$inc': { version: 1 }, '$set': { attr: 'bar' } },
* { multi: true }
* )
*/
Model.findOneAndUpdate({attr: 'foo'}, {attr: 'bar'});
/*
* mongo query:
* model.findAndModify(
* { attr: 'foo' },
* { '$inc': { version: 1 }, '$set': { attr: 'bar' } },
* { new: false, upsert: false }
* )
*/
FAQs
Force version to increment every time you update or save a mongoose document
We found that @syntropy/mongoose-document-versioner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.