Difference between revisions of "My MongoDB notes"

From Got Opinion Wiki
Jump to navigation Jump to search
Line 75: Line 75:
== MongoDB drivers ==
== MongoDB drivers ==


[https://docs.mongodb.com/ecosystem/drivers/ MongoDB ecosystem drivers] page
[https://docs.mongodb.com/ecosystem/drivers/ MongoDB ecosystem drivers]


[https://docs.mongodb.com/ecosystem/drivers/node/Node.js MongoDB Node.js drivers]
[https://docs.mongodb.com/ecosystem/drivers/node/Node.js MongoDB Node.js drivers]


<center>[[Ubuntu|My Ubuntu notes]] | [[Windows 10 Notes|My Windows 10 notes]]</center>
<center>[[Ubuntu|My Ubuntu notes]] | [[Windows 10 Notes|My Windows 10 notes]]</center>

Revision as of 15:42, 20 July 2019

MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era.

Ubuntu

install

Install and run MongoDB Community Edition on Ubuntu 18.04 LTS

The site has excellent documentation so I am simply providing overview of steps.

  1. Import the public key used by the package management system.
  2. Create a list file for MongoDB.
  3. Reload local package database.
  4. Install the MongoDB packages.

Run MongoDB Community Edition

  1. Start MongoDB with sudo service mongod start
  2. Verify that MongoDB has started successfully with sudo grep port /var/log/mongodb/mongod.log
  3. Stop MongoDB with sudo service mongod stop
  4. Restart MongoDB with sudo service mongod restart
  5. Begin using MongoDB shell with mongo

Running mongo shell for first time

$ mongo
MongoDB shell version v4.0.10
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("<uuid_value>") }
MongoDB server version: 4.0.10
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
        http://docs.mongodb.org/
Questions? Try the support group
        http://groups.google.com/group/mongodb-user
Server has startup warnings: 
2019-07-20T17:50:10.139-0500 I STORAGE  [initandlisten] 
2019-07-20T17:50:10.139-0500 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-07-20T17:50:10.139-0500 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-07-20T17:50:10.653-0500 I CONTROL  [initandlisten] 
2019-07-20T17:50:10.653-0500 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-07-20T17:50:10.653-0500 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-07-20T17:50:10.653-0500 I CONTROL  [initandlisten] 
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).

The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.

To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---

>

Windows 10 (dev environment)

Download MongoDB Community Edition zip package

Extract downloaded file and rename to root directory to mongodb.

Move mongodb directory to user profile. On my Windows 10 dev machine the absolute path is C:\Users\anon\mongodb.

Create directory in same profile that will hold mongodb collections called mongodb-data. The absolute path is C:\Users\anon\mongodb-db.

To run MongoDB open shell in C:\Users\anon\mongodb\bin directory and type .\mongod.exe --dbpath=\Users\anon\mongodb-data\

MongoDB GUI

Robo 3T (formerly Robomongo) is the free lightweight GUI for MongoDB enthusiasts.

MongoDB drivers

MongoDB ecosystem drivers

MongoDB Node.js drivers

My Ubuntu notes | My Windows 10 notes