curious-connect
v1.0.1
Published
Make MongoDB Atlas more easier now
Downloads
12
Readme
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