1.2.4 • Published 5 years ago

loopback-mixin-mongo-seq v1.2.4

Weekly downloads
6
License
ISC
Repository
github
Last release
5 years ago

MONGO-SEQ Build Status

loopback v3 mixin to add support for sequential property.

usage

  • install via npm.
npm install loopback-mixin-mongo-seq
  • update server.js to load mixin.
const loopbackMixinMongoSeq = require('loopback-mixin-mongo-seq');

loopbackMixinMongoSeq(app, {
  dataSource: 'MongoDS', modelName: 'Counter'
});
  • add mixins property to the required model.
"mixins": {
  "Seq" : {
    "propertyName": "ID",
    "step": 1,
    "initialVal": 1,
    "readOnly": true,
    "definition": {
      "index": { "unique": true }
    }
  }
}

options

propertyName: property name, defaults to ID.

step: defaults to 1.

initialVal: value to start counter from if the sequence doesn't exist, defaults to the highest record in the target model if not found then 1.

readOnly: if the value should be protested against changes, defaults to true.

definition: property definition ( can be used to add index to property), defaults to {}.

DEBUG MODE

DEBUG='loopback:mixin:mongo-seq'
1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.4

5 years ago

1.1.2

5 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.1.0

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago