2.0.2 • Published 6 years ago

mxmongo v2.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

IMPORTANT NOTICE!

THIS PACKAGE'S NAME HAS BEEN CHANGED TO basicmongo!!!

PLEASE VISIT basicmongo TO GET FUTURE UPDATE!!!

WHAT'S NICE ABOUT THIS MODULES?

  1. Offer an easier way to access mongodb, no more callbacks after callbacks.
  2. In each instance commands will be run by sequnce, you don't have to worry about those "find" command run before "update" command situations anymore.

HOW TO USE?

Quick Start

    const BasicMongo = require('basicmongo');
    const mongo = BasicMongo.create(
        '%YOUR HOST%',
        %YOUR PORT%,
        '%YOUR DATABASE%',
        %DEBUG OR NOT%);

    mongo
        .run( (db, resolve, reject) => {
            db.collection('test')
                .find({})
                .toArray(
                    (err, result) => {
                        console.log(result);
                        resolve(result);
                    }
                )
        } )
        .get( (result, resolve) => {
            console.log(result);
            resolve();
        } );

Or You Can Use EasyMongo Methods

    mongo
        .collection('test')

        .find({})
        .get( (data, resolve) => {
            console.log(data);
            resolve();
        } )

        .insert({ title: 'test' })

        .find({})
        .get( (data, resolve) => {
            console.log(data);
            resolve();
        } )

        .remove({ title: 'test' })

        .find({})
        .get( (data, resolve) => {
            console.log(data);
            resolve();
        } );

Method List

Basic Methods

  • run (runCommandFunc)
    • runCommandFunc (db, resolve, reject)
  • get (getCommandFunc)
    • getCommandFunc (result, resolve, reject)

EasyMongo Methods

  • insert (docs, options)
  • remove (selector, options)
  • update (selector, doc, options)
    • default options = { upsert : true, multi : true }
  • find (query, options) // You should use get method to get result.
  • rename (newName, options)
  • aggregate (pipeline, options) // You should use get method to get result.

CONTACT ME

Email: Maplemx@gmail.com

2.0.2

6 years ago

2.0.0

6 years ago

2.0.1

6 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago