Created
June 24, 2020 13:07
-
-
Save velotiotech/6e0428333c15b3ff2efb6a6dde760103 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { MongoClient } from "https://deno.land/x/mongo@v0.8.0/mod.ts"; | |
const client = new MongoClient(); | |
client.connectWithUri("mongodb://localhost:27017"); | |
const db = client.database("test"); | |
const users = db.collection("cities"); | |
// insert | |
const insertId = await users.insertOne({ | |
name: "Delhi", | |
country: "India", | |
population: 10000 | |
}); | |
console.log(`Successfully inserted with the id: ${JSON.stringify(insertId)}`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment