curious-connect

1.0.1 • Public • Published

curious-connect

About

You can now connect with your mongodb atlas more easier now.

Installation

const Connection = require('curious-connect');
const myDB = new Connection.Connect(URI, true, true);

First of all let import the document. than create a object of connect class, there are three parameter. First URI your mongodb atlas uri goes here. Second useNewUrlParser bydefault it is true so you can ignore it. and third one is useUnifiedTopology it also true as bydefault.

Connecting to Atlas

myDB.call(async (client) => {
    // you can perform your action here
});

Want to execute a command. Simple just call this async function you will get client instance which use to make your work easier.

Example

const Connection = require('curious-connect');
const myDB = new Connection.Connect(URI);
myDB.call(async (client) => {
    await client.db("pokemon").collection("legendery").
    insertOne({
         _id:"00112233445566778899",
         name:"mew",
         hp:"99999",
         type:"rare"
     })
});

Above example state that you are connecting to you Atlas and inserting a new entry to your legendery collection followed by pokemon database.

NOTE: Calling your function don't forget to add await keyword

You are ready now. go and create awesome things

/curious-connect/

    Package Sidebar

    Install

    npm i curious-connect

    Weekly Downloads

    5

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    3.69 kB

    Total Files

    3

    Last publish

    Collaborators

    • thestanfox