GithubHelp home page GithubHelp logo

eslachance / enmap-mongo Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 2.0 14 KB

Enmap-Mongo is a provider for the [Enmap](https://www.npmjs.com/package/enmap) module.

License: Apache License 2.0

JavaScript 100.00%

enmap-mongo's Introduction

Enmap-Mongo

Enmap-Mongo is a provider for the Enmap module.

Installation

To install Enmap-Mongo simply run npm i enmap-mongo.

Usage

// Load Enmap
const Enmap = require('enmap');
 
// Load EnmapMongo
const EnmapMongo = require('enmap-mongo');
 
// Initialize the provider
const Provider = new EnmapMongo({ name: 'test' });
 
// Initialize the Enmap with the provider instance.
const myColl = new Enmap({ provider: provider });

Shorthand declaration:

const Enmap = require('enmap');
const EnmapMongo = require('enmap-mongo');
const myColl = new Enmap({ provider: new EnmapMongo({ name: 'test' }) });

Options

// Example with all options.
const level = new EnmapMongo({ 
  name: 'test',
  dbName: 'enmap',
  user: 'username',
  pass: 'password',
  host: 'localhost',
  port: 27017
});
// Example with full URL.
const level = new EnmapMongo({ 
  name: 'test',
  dbName: 'enmap',
  url: 'mongodb://username:password@localhost:27017/enmap'
});

name

The name option is mandatory and defines the name of the collection where the data is stored.

dbName

The dbName is optional and defines the database where data is stored. If multiple enmap instances connect to the same database, the same database is used with different table collections. The default database is enmap.

host

The host is optional and defines which host this module attempts to connect to. The default host is localhost.

port

The port is optional and defines which port is used to connect to the Rethink DB. The default port is 27017.

user, pass

Optional, used for authentication. Needs both to work, or neither.

url

Optional. If used, the host, port, user and pass options are ignored , and url is used instead. Note that the /dbname at the end of your url must correspond to the dbName value (or enmap).

enmap-mongo's People

Contributors

danielwerg avatar eslachance avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

enmap-mongo's Issues

Unhandled Promise

Heres the long story short:

(node:5654) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [minimebot-avzam.gcp.mongodb.net:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND minimebot-avzam.gcp.mongodb.net minimebot-avzam.gcp.mongodb.net:27017]

at Pool.<anonymous> (/rbd/pnpm-volume/5470c346-4081-4729-9bec-e01121a104fb/node_modules/.registry.npmjs.org/mongodb-core/3.0.9/node_modules/mongodb-core/lib/topologies/server.js:505:11)

    at emitOne (events.js:116:13)

    at Pool.emit (events.js:211:7)

    at Connection.<anonymous> (/rbd/pnpm-volume/5470c346-4081-4729-9bec-e01121a104fb/node_modules/.registry.npmjs.org/mongodb-core/3.0.9/node_modules/mongodb-core/lib/connection/pool.js:329:12)

    at Object.onceWrapper (events.js:317:30)

    at emitTwo (events.js:126:13)

    at Connection.emit (events.js:214:7)

    at Socket.<anonymous> (/rbd/pnpm-volume/5470c346-4081-4729-9bec-e01121a104fb/node_modules/.registry.npmjs.org/mongodb-core/3.0.9/node_modules/mongodb-core/lib/connection/connection.js:245:50)

    at Object.onceWrapper (events.js:315:30)

    at emitOne (events.js:116:13)

(node:5654) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

(node:5654) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.


/rbd/pnpm-volume/5470c346-4081-4729-9bec-e01121a104fb/node_modules/.registry.npmjs.org/mongodb/3.0.10/node_modules/mongodb/lib/mongo_client.js:794

          throw err;

          ^

MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017]

at Pool.<anonymous> (/rbd/pnpm-volume/5470c346-4081-4729-9bec-e01121a104fb/node_modules/.registry.npmjs.org/mongodb-core/3.0.9/node_modules/mongodb-core/lib/topologies/server.js:505:11)

    at emitOne (events.js:116:13)

    at Pool.emit (events.js:211:7)

    at Connection.<anonymous> (/rbd/pnpm-volume/5470c346-4081-4729-9bec-e01121a104fb/node_modules/.registry.npmjs.org/mongodb-core/3.0.9/node_modules/mongodb-core/lib/connection/pool.js:329:12)

    at Object.onceWrapper (events.js:317:30)

    at emitTwo (events.js:126:13)

    at Connection.emit (events.js:214:7)

    at Socket.<anonymous> (/rbd/pnpm-volume/5470c346-4081-4729-9bec-e01121a104fb/node_modules/.registry.npmjs.org/mongodb-core/3.0.9/node_modules/mongodb-core/lib/connection/connection.js:245:50)

    at Object.onceWrapper (events.js:315:30)

    at emitOne (events.js:116:13)

it won't connect to my remote MongoDB instance
for your info:
i am hosting on glitch and i want to do the points guide from An Idiots Guide and now my bot won't even run because it's throwing an error

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.