Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@syntropy/mongoose-document-versioner

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@syntropy/mongoose-document-versioner - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

2

package.json
{
"name": "@syntropy/mongoose-document-versioner",
"version": "2.0.1",
"version": "2.0.2",
"description": "Force version to increment every time you update or save a mongoose document",

@@ -5,0 +5,0 @@ "main": "src/",

@@ -12,2 +12,3 @@ const set = require('lodash.set');

if (
!has(this, '_update.version') &&
!has(this, '_update.$inc.version') &&

@@ -14,0 +15,0 @@ !has(this, '_update.$set.version') &&

@@ -49,3 +49,3 @@ const assert = require('assert');

it('does not bump the version of a document in an updateOne query when the version is already set in the query', function () {
it('correctly handles updateOne when the version is set in the query', function () {
return Starship.create({name: 'USS Geronimo'})

@@ -64,2 +64,16 @@ .then(function (ship) {

it('correctly handles findOneAndUpdate when the version is set in the query', function () {
return Starship.create({name: 'USS Geronimo'})
.then(function (ship) {
assert.equal(ship.version, 1);
return Starship.findOneAndUpdate({name: 'USS Geronimo'}, {version: 3}, {new: true})
.then(function () {
return Starship.findById(ship.id);
});
})
.then(function (ship) {
assert.equal(ship.version, 3);
});
});
it('bumps the version of a document with an updateMany query', function () {

@@ -66,0 +80,0 @@ return Promise.all([

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc