insert into mongodb node js
//CRUD
const mongodb = require('mongodb');
const MongoClient = mongodb.MongoClient;
const connectionURl = 'mongodb://127.0.0.1:27017';
const databaseName = 'task-manager';
MongoClient.connect(
connectionURl,
{ useNewUrlParser: true },
(error, client) => {
if (error) {
return console.log('unable to connect to database');
}
const db = client.db(databaseName);
db.collection('users').insertOne({
name: 'user',
age: 24,
});
}
);
Also in JavaScript:
- vscode new file shortcut
- face-api.js
- function click anywhere javascript
- how get parent element javascript
- obj[key].includes is not a function
- find base url in javascript
- react dark mode npm
- javascript reverse each string element in array
- react setState
- js greater than or equal to
- react native vector icons
- javascript function
- Material-ui wheelchair icon
- convert timestamp to date js
- how to initialize empty javascript object
- react window navigate
- if(gender.length === 0) javascript
- js convert double to int
- javascript code to loop through array
- make random letter capital in string javascript
- node js console log
- js check proccess alive
- jquery script url
- active-class router-link