Skip to content

Commit

Permalink
ref: fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
sksmta authored Jan 20, 2022
1 parent fbe269f commit 8047c9b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,20 @@ $ npm install --save quickmongo
# Example

```js
const { Database } = require("quickmongo");
import { Database } from 'quickmongo';

const db = new Database("mongodb://localhost/quickmongo");
const db = new Database("mongodb://localhost:27017/quickmongo");

db.on("ready", () => {
console.log("Connected to the database");
doStuff();
});

db.connect();
// top-level awaits
await db.connect();
await doStuff();

function doStuff() {
async function doStuff() {
// Setting an object in the database:
await db.set("userInfo", { difficulty: "Easy" });
// -> { difficulty: 'Easy' }
Expand Down

0 comments on commit 8047c9b

Please sign in to comment.