0.3.0 • Published 6 years ago
gamecollection-mongodb v0.3.0
gamecollection-mongodb
MongoDB wrapper to retrieve data for your game collection
Table of Contents
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.