/json-patch-to-mongodb-ops

TypeScript code to convert JSON Patch to bulk-writable MongoDB operations

Primary LanguageTypeScriptCreative Commons Zero v1.0 UniversalCC0-1.0

🥭 json-patch-to-mongodb-ops

This repository contains a script written in TypeScript to convert JSON Patch to MongoDB update operations, which can be written in bulk without querying and loading the target document into memory. This makes applying JSON Patch to a MongoDB document faster and more memory-efficient.

Supported JSON Patch operations: add, remove, replace, copy and move.

The functionality of the script has been tested using this test set of operations.

Usage

Copy jsonPatchToMongoDbOps.ts to your project and integrate the dependencies listed in package.json.