mongo-move
TypeScript icon, indicating that this package has built-in type declarations

5.1.2 • Public • Published

Mongo Move CircleCI node (tag)

Move documents between MongoDB collection. Applying async transforms, optionally.

Install

$ yarn add mongo-move

Usage

import {MongoClient} from 'mongodb';
import {moveDocs} from 'mongo-move';

const db = await MongoClient.connect('mongo-url');

await moveDocs({
  fromCollection: db.collection('coll-a'),
  toCollection: db.collection('coll-b'),
  selector: {userId: 'some-user-id'},
  projection: {name: 0},
  transformerFn: async doc => {
    doc.movedAt = new Date();
    return doc;
  },
  chunkSize: 1000,
});

Publish

$ git checkout master
$ yarn version
$ yarn publish
$ git push origin master --tags

License

MIT © Vlad Holubiev

Readme

Keywords

none

Package Sidebar

Install

npm i mongo-move

Weekly Downloads

2,938

Version

5.1.2

License

UNLICENSED

Unpacked Size

7.07 kB

Total Files

7

Last publish

Collaborators

  • vladgolubev