MongoDB-core Library
The MongoDB-core library is a powerful and flexible utility for interacting with MongoDB databases, designed to streamline and simplify common database operations. Whether you're building a small application or a complex system, this library provides essential functions to manage your data effectively.
Features
- Create: Easily create and insert new documents into your MongoDB collections.
- findById: Retrieve documents by their unique identifier.
- findByIds: Fetch a batch of documents using a list of IDs.
- findOne: Quickly find a single document based on specified criteria.
- findAll: Retrieve all documents that match a given set of conditions.
- update: Seamlessly update documents with new information or modifications.
- softDelete: Perform soft delete operations, allowing you to retain data while marking it as deleted.
- session: Manage transactions and operations within a session to maintain data integrity.
Installation
- Install the dependencies:
yarn
Usage
To integrate the MongoDB-core library into your project, follow these steps:
- Install the library using a package manager of your choice:
npm install @incresco/mongodb-core
- import the BaseService in your project:
import { BaseService } from '@incresco/mongodb-core';
Deployment
Before deploying and publishing your package, remember to increment the version number each time you make changes to the package. This ensures that users can identify and access the latest version of your library.
Follow these steps to deploy your changes and publish the package:
- Install dependencies and build the project:
yarn
- Log in to your npm account:
npm login
- Increment the version number in the package.json file based on your changes.
- Publish the package to npm:
npm publish
By increasing the version number and publishing the package, you're providing users with the most up-to-date features and improvements. Remember that semantic versioning (SemVer) principles can guide you in determining how to update the version number (e.g., major, minor, patch) based on the nature of the changes made.|
Contribution
Contributions to the MongoDB-core library are welcome! If you encounter any issues or have suggestions for improvements, please feel free to submit a pull request or open an issue on the GitHub repository.