@reneos/mongot

1.0.31 • Public • Published

reneos.mongot

A module to simplify working with database connections and MongoDB collections

install

npm install @reneos.mongot --save

https://www.npmjs.com/package/@reneos/mongot

How to use

import {DataManager,Database,DataConnection} from "@reneos/mongot"

Connect

  1. You can create one global database connection
	await DataManager.Init({
	"url": "mongodb://127.0.0.1:27017/",
	"database": "yourdatabase",
	"options": {	}
})

Load documents from Config collection

const configs = await DataManager.Configs.find().toArray()
  1. You can use multiple connections to different databases
	const _db = new DataConnection("anydbkey")

	await _db.open({
	"url": "mongodb://127.0.0.1:27017/",
	"database": "yourdatabase",
	"options": {	}
})

Load documents from Config collection

const configs = await _db.Configs.find().toArray()
OR
const configs = DataConnection.GetConnection('anydbkey').Configs.find().toArray()

Readme

Keywords

Package Sidebar

Install

npm i @reneos/mongot

Weekly Downloads

0

Version

1.0.31

License

MIT

Unpacked Size

5.7 kB

Total Files

7

Last publish

Collaborators

  • reneos