Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/paulhobbel/commando-provider-mongo
A MongoDB provider for Commando
https://github.com/paulhobbel/commando-provider-mongo
discord-commando discord-js mongodb mongodb-provider
Last synced: 2 days ago
JSON representation
A MongoDB provider for Commando
- Host: GitHub
- URL: https://github.com/paulhobbel/commando-provider-mongo
- Owner: paulhobbel
- License: mit
- Created: 2017-09-17T17:25:38.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2023-07-12T09:31:22.000Z (over 1 year ago)
- Last Synced: 2025-01-06T03:37:22.154Z (6 days ago)
- Topics: discord-commando, discord-js, mongodb, mongodb-provider
- Language: TypeScript
- Size: 52.7 KB
- Stars: 12
- Watchers: 3
- Forks: 12
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Commando MongoDBProvider
[![Downloads](https://img.shields.io/npm/dt/commando-provider-mongo.svg)](https://www.npmjs.com/package/commando-provider-mongo)
[![Version](https://img.shields.io/npm/v/commando-provider-mongo.svg)](https://www.npmjs.com/package/commando-provider-mongo)
[![Dependency status](https://david-dm.org/ItsDizzy/commando-provider-mongo.svg)](https://david-dm.org/ItsDizzy/commando-provider-mongo)MongoDB provider for Commando
## About
[Commando](https://github.com/Gawdl3y/discord.js-commando) is the official framework for [discord.js](https://github.com/hydrabolt/discord.js), I like how easy it is to get started with it and add own commands, types, etc. Recently I started working on a bot that required to be connected to MongoDB. I converted the default SQLLiteProvider into a provider that could use MongoDB as storage.## Installation
>If you want to use Discord.js v11, use [email protected]!
```bash
# With Yarn (recommended)
yarn add mongodb commando-provider-mongo# With NPM
npm install --save mongodb commando-provider-mongo
```## Usage
Below is an example on how to use it with [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) (recommended). There are probably other mongodb clients whose are able to return a Db instance of MongoClient and you are free to use them. However I will not deliver any support if you use another client.```js
const MongoClient = require('mongodb').MongoClient;
const MongoDBProvider = require('commando-provider-mongo').MongoDBProvider;...
client.setProvider(
MongoClient.connect('mongodb://localhost:27017').then(client => new MongoDBProvider(client, 'abot'))
).catch(console.error);...
```## License
MIT © [Paul Hobbel](https://github.com/paulhobbel)