JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14
  • Score
    100M100P100Q28931F
  • License ISC

multiple database mongodb and json

Package Exports

  • multiple.db
  • multiple.db/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (multiple.db) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

multiple.db

Its Multiple Package store data in JSON format And MongoDB Database!

npm

How To Use multiple.db with MongoDB

const db = require('multiple.db'); // npm i multiple.db

// Connect to the database
await db.connect('mongodb://localhost/test').catch((err) => {
  console.log(err)
})
// This if Using Mongoose
db.useMongoDB();

// Add a value
await db.add('key', 1);

// Subtract a value
await db.subtract('key', 2);

// Set a value
await db.set('key', 'value');

// Delete a value
await db.trash('key');

// Get a value
awiat db.get('key');

// Check if a key exists
const exists = await db.has('key');
console.log(exists); // Output: false

// Get all values
const values = await db.all();
console.log(values); // Output: []

// Fetch a value
const value = await db.fetch('key');
console.log(value); // Output: undefined

// Reset the database
await db.reset();

How To Use multiple.db with JSON format

const db = require('multiple.db'); // npm i multiple.db

// This if You Want Storage with **JSON**
db.useJSON();

// Add a value
await db.add('key', 1);

// Subtract a value
await db.subtract('key', 2);

// Set a value
await db.set('key', 'value');

// Delete a value
await db.trash('key');

// Get a value
awiat db.get('key');

// Check if a key exists
const exists = await db.has('key');
console.log(exists); // Output: false

// Get all values
const values = await db.all();
console.log(values); // Output: []

// Fetch a value
const value = await db.fetch('key');
console.log(value); // Output: undefined

// Reset the database
await db.reset();

Need Help ?

Contact With Me Discord : </SmSm>#8700