martes, 29 de agosto de 2017

Mongodb: Start server

1) Navigate to the folder where your mongo executables are (usually placed on user's folder)
2) Starts the server, creates an active connection to manipulate data:
./mongod --dbpath ~/mongo-data // Or whatever your folder name is
3) On another tab run:
./mongo // connects to the database

Mongodb: Object destructuring

Obtain variables from object properties.

var user = {name: ‘Andrew’, age: 25};var {name} = user;


Also

const {MongoClient} = require('mongodb');

is equal to 

const MongoClient = require('mongodb').MongoClient;