Socket
Book a DemoInstallSign in
Socket

mongoose-sequencer-tbs

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-sequencer-tbs

Package for handling sequence number on mongodb with creating new collection that held all sequence key and counter.

0.0.2
latest
Source
npmnpm
Version published
Weekly downloads
24
-4%
Maintainers
1
Weekly downloads
 
Created
Source

Mongoose Sequencer TBS

Package for handling sequence number on mongodb with creating new collection that held all sequence key and counter.

Installation

Yarn

yarn add mongoose-sequencer-tbs

NPM

npm install mongoose-sequencer-tbs

Getting Started

Initialize package

import { MongooseSequencerInit } from 'mongoose-sequencer-tbs';

const init = await MongooseSequencerInit(
  'mongodb://user:password@host:port?authMechanism=SCRAM-SHA-256&authSource=admin',
  'db_name',
  ['user', 'order']
);

if (typeof init === 'string') {
  throw new Error(init);
}

Get the next counter

import { MongooseSequencerNext } from 'mongoose-sequencer-tbs';

const seq = await MongooseSequencerNext('user');
const errorEx = await MongooseSequencerNext('not-registered-on-init');

console.log(seq) // 1 or 2 or 3 etc
console.log(errorEx) // Error instance with message `Sequence with key not-registered-on-init not found. Make sure you have registered the init function`

FAQs

Package last updated on 26 Jan 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.