# mongo-move

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

Latest version **5.1.2** (published 2021-09-16) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install mongo-move
pnpm add mongo-move
yarn add mongo-move
bun add mongo-move
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.1.2 |
| Published | 2021-09-16 |
| First published | 2017-10-10 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=14 |
| Dependencies | 0 |
| Unpacked size | 6.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Vlad Holubiev |
| Maintainers | vladgolubev |

## Links

- npm: https://www.npmjs.com/package/mongo-move
- npm.io page: https://npm.io/package/mongo-move

## Recent versions

- 5.1.2 (latest) — 2021-09-16
- 5.1.1 — 2021-05-01
- 5.1.0 — 2021-04-30
- 5.0.1 — 2021-04-30
- 4.0.0 — 2018-06-17
- 3.0.0 — 2017-11-06
- 2.0.0 — 2017-10-17
- 1.0.0 — 2017-10-10

## README

# Mongo Move [![CircleCI](https://img.shields.io/circleci/project/github/vladgolubev/mongo-move.svg)](https://circleci.com/gh/vladgolubev/mongo-move) ![](https://img.shields.io/badge/code_style-prettier-ff69b4.svg) ![node (tag)](https://img.shields.io/node/v/mongo-move/latest.svg)

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

## Install

```sh
$ yarn add mongo-move
```

## Usage

```js
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

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

## License

MIT © [Vlad Holubiev](https://vladholubiev.com)

---
_Source: https://npm.io/package/mongo-move · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
