1.0.9 • Published 1 month ago

g_mdb v1.0.9

Weekly downloads
-
License
ISC
Repository
github
Last release
1 month ago

GMDb: A Node.js Module for MongoDB Interactions

Overview

GMDb simplifies common MongoDB operations within Node.js applications, providing a streamlined interface for tasks like:

Finding documents Finding single documents Updating documents Inserting documents Sorting, skipping, and limiting results Counting documents

Installation

Install the module using npm or yarn:

npm install gmdb

Use code with caution. Learn more

Usage

Import the module:

const GMDb = require('gmdb');

Use code with caution. Learn more

Create a new instance:

const db = new GMDb('your_mongodb_connection_url');

Use code with caution. Learn more Perform operations:

// Find documents
const results = await db.find('myDatabase', 'myCollection', { name: 'John' })
.then(resullt=>{}).catch(error=>{});

// Find a single document
const document = await db.findone('myDatabase', 'myCollection', { age: 30 })
.then(resullt=>{}).catch(error=>{});

// Update a document
const updateResult = await db.updateOne('myDatabase', 'myCollection', { name: 'John' }, { $set: { age: 35 } })
.then(resullt=>{}).catch(error=>{});

// Insert a document
const insertResult = await db.insertOne('myDatabase', 'myCollection', { name: 'Alice', age: 25 })
.then(resullt=>{}).catch(error=>{});

// Find with sorting, skipping, and limiting
const sortedResults = await db.findSortSkipLimit('myDatabase', 'myCollection', {}, { age: 1 }, 5, 10)
.then(resullt=>{}).catch(error=>{});

// Count documents
const count = await db.countOfData('myDatabase', 'myCollection', {})
.then(resullt=>{}).catch(error=>{});

// Insert index
const insertIndexResult = await db.createIndex('myDatabase', 'myCollection', {id: 1},{uinique: true})

Use code with caution. Learn more

Examples

(Provide code examples demonstrating typical usage scenarios)

API Reference

(List and describe the module's methods and properties)

Contributing

(Guidelines for contributing to the module's development)

License

1.0.9

1 month ago

1.0.8

2 months ago

1.0.7

2 months ago

1.0.5

3 months ago

1.0.2

3 months ago

1.0.3

3 months ago

1.0.1

9 months ago

1.0.0

9 months ago