0.3.0 • Published 6 years ago

gamecollection-mongodb v0.3.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

gamecollection-mongodb

MongoDB wrapper to retrieve data for your game collection

Table of Contents

  1. Configuration
  2. Require / Import
  3. Available functions

Configuration

Create a hidden file called .gamecollection.config.js in your home directory to make a connection to your MongoDB database.

$ touch ~/.gamecollection.config.js
module.exports = {
  url: 'mongodb://[username:password@]host1[:port1][/[database][?options]]',
  db: 'nameOfYourDatabase',
  collection: 'games'
};

Require / Import

$ yarn add gamecollection-mongodb

or

$ npm install --save gamecollection-mongodb

Require and use it in your application

const gcdb = require('gamecollection-mongodb');
const gamesPerPlatform = await gcdb.getGamesPerPlatform();

Available functions

async getGames();
// outputs [{}, {}, ...]
async getGamesPerPlatform();
/* outputs
[
  {
    platform: string,
    games: [{}, {}, ...]
  },
  ...
]
*/
async getGame(mongodbID);
/* outputs
{
  title: string
  platform: array
  releaseDate: string
  overview: string
  ESRB: string
  players: string
  youtube: string
  rating: string
  similar: array
  publisher: string
  developer: string
  genres: array
  images: array
}
*/
async addGame(Object);
async updateGame(mongodbID, field, value);
async deleteGame(mongodbID);
async dropGameCollection();

Contributing

When contributing, please respect the ESLint rules and add unit tests.

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.1.1

6 years ago

0.0.1

6 years ago