npm.io
1.0.5 • Published 3 years ago

update-mongo-db

Licence
ISC
Version
1.0.5
Deps
3
Size
14 kB
Vulns
0
Weekly
0

My update mongoDB npm Package

Overview

update-mongo-db is an npm package for updating field names and types in MongoDB collections.

Features

  • Flexible Field Editing: You can easily edit field names and types in your MongoDB documents.
  • Data Types Supported: Update field types to boolean, string, date, and objectId.
  • Deep Nesting: The program handles updates within arrays, objects, and other nested structures.

Installation

To install update-mongo-db, run the following command:

npm install update-mongo-db 

Usage

npm run updateDB <update type> <path to field> <update value>

Example

before: { someObject:{ someArray:[{ fieldName: "true", }...] } }

// to change from string to boolean
npm run updateDB type collectionName.someObject.someArray.fieldName bool

// to change name of field
npm run updateDB name collectionName.someObject.someArray.fieldName newName

after: { someObject:{ someArray:[{ newName: true }...] } }