Socket
Book a DemoInstallSign in
Socket

api-mongo

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-mongo

MongoDB API wrapper

0.0.1
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

api-mongo

A non-relational database wrapper for MongoDB

Requirements:

  • mongodb 2.2.10

Getting started

Make sure your database is running and listening on port 27017. You can do that by running bash $ mongod.

Once the database is running, and your configuration is in place, you can run this package:

$ npm install;
$ npm test;
$ npm start;

Basic usage

const MongoClient = require("api-mongo");
const url = 'mongodb://localhost:27017/test';
const mongo = new MongoClient(url);

let person = {};
person.givenName = 'Jose';
person.familyName = 'Barrios';

//Insert document to collection
mongo.insertDocument('people', data)
    .then(res => {
        //Do something with DB response
        console.log(res);
    })
    .catch(err =>{
        //Handle error response
        console.error(err);
    })

Public Methods

OperationParametersUnit test
insertDocumentcollection:String, data:Object
getDocumentByIDid:ObjectID
updateDocumentcollection:String, id:ObjectID, data:Object
deleteDocument{ collection:String, id:ObjectID }

Keywords

Mongo

FAQs

Package last updated on 17 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.