JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2353
  • Score
    100M100P100Q127489F
  • License MIT

Optimistic concurrency (OCC) plugin for mongoose

Package Exports

  • mongoose-update-if-current
  • mongoose-update-if-current/dist/index.browser.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mongoose-update-if-current) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

mongoose-update-if-current

Build Status NPM version Node version Dependencies DevDependencies Maintainability Test Coverage

Optimistic concurrency (OCC) plugin for mongoose v4.8 and higher.

Increments document version numbers on each save, and prevents previous versions of a document from being saved over a newer version.

Inspired by this issue in the mongoose repo.

See the __tests__ directory for examples.

Install

$ npm install --save mongoose-update-if-current

Usage

On a single schema:

import { updateIfCurrentPlugin } from 'mongoose-update-if-current';
const mongoose = require('mongoose');

const mySchema = new mongoose.Schema({ ... });
mySchema.plugin(updateIfCurrentPlugin);

Globally:

import { updateIfCurrentPlugin } from 'mongoose-update-if-current';
const mongoose = require('mongoose');

mongoose.plugin(updateIfCurrentPlugin);

Commands

npm run build             # build the library files
npm run test              # run the tests
npm run coverage          # run the tests with coverage
npm run prepare           # build the library, make sure the tests passes, and then pack the library (creates .tgz)
npm run release           # prepare package for next release

License

MIT