Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases Mongo Basics Getting Started With MongoDB Setting Up MongoDB

Erik L
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Erik L
Full Stack JavaScript Techdegree Graduate 19,470 Points

Not sure if mongo was installed correctly?

So I just finished watching this video and when I installed mongoDB and ran mongod this is what I got:

mongod I dont't understand everything in here, but this caught my attention: Access control is not enabled for the database. how can I fix this? does this mean I have no control over my database as an admin??

Eriks-MacBook-Pro:~ eriklopezramirez$ mongod
2019-02-13T18:54:45.588-0500 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-02-13T18:54:45.602-0500 I CONTROL  [initandlisten] MongoDB starting : pid=36461 port=27017 dbpath=/data/db 64-bit host=Eriks-MacBook-Pro.local
2019-02-13T18:54:45.602-0500 I CONTROL  [initandlisten] db version v4.0.3
2019-02-13T18:54:45.602-0500 I CONTROL  [initandlisten] git version: 7ea530946fa7880364d88c8d8b6026bbc9ffa48c
2019-02-13T18:54:45.602-0500 I CONTROL  [initandlisten] allocator: system
2019-02-13T18:54:45.602-0500 I CONTROL  [initandlisten] modules: none
2019-02-13T18:54:45.602-0500 I CONTROL  [initandlisten] build environment:
2019-02-13T18:54:45.602-0500 I CONTROL  [initandlisten]     distarch: x86_64
2019-02-13T18:54:45.602-0500 I CONTROL  [initandlisten]     target_arch: x86_64
2019-02-13T18:54:45.602-0500 I CONTROL  [initandlisten] options: {}
2019-02-13T18:54:45.603-0500 I STORAGE  [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2019-02-13T18:54:45.603-0500 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=3584M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2019-02-13T18:54:46.227-0500 I STORAGE  [initandlisten] WiredTiger message [1550102086:227676][36461:0x7fff8a721380], txn-recover: Main recovery loop: starting at 1/24192
2019-02-13T18:54:46.314-0500 I STORAGE  [initandlisten] WiredTiger message [1550102086:314136][36461:0x7fff8a721380], txn-recover: Recovering log 1 through 2
2019-02-13T18:54:46.373-0500 I STORAGE  [initandlisten] WiredTiger message [1550102086:373738][36461:0x7fff8a721380], txn-recover: Recovering log 2 through 2
2019-02-13T18:54:46.416-0500 I STORAGE  [initandlisten] WiredTiger message [1550102086:416895][36461:0x7fff8a721380], txn-recover: Set global recovery timestamp: 0
2019-02-13T18:54:46.453-0500 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2019-02-13T18:54:46.481-0500 I CONTROL  [initandlisten] 
2019-02-13T18:54:46.481-0500 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-02-13T18:54:46.481-0500 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-02-13T18:54:46.481-0500 I CONTROL  [initandlisten] 
2019-02-13T18:54:46.481-0500 I CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2019-02-13T18:54:46.481-0500 I CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server. 
2019-02-13T18:54:46.481-0500 I CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP 
2019-02-13T18:54:46.481-0500 I CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2019-02-13T18:54:46.481-0500 I CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2019-02-13T18:54:46.481-0500 I CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2019-02-13T18:54:46.481-0500 I CONTROL  [initandlisten] 
2019-02-13T18:54:46.481-0500 I CONTROL  [initandlisten] 
2019-02-13T18:54:46.481-0500 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2019-02-13T18:54:46.510-0500 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2019-02-13T18:54:46.513-0500 I NETWORK  [initandlisten] waiting for connections on port 27017
2019-02-13T19:15:17.161-0500 I NETWORK  [listener] connection accepted from 127.0.0.1:51615 #1 (1 connection now open)
2019-02-13T19:15:17.179-0500 I NETWORK  [conn1] received client metadata from 127.0.0.1:51615 conn1: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.3" }, os: { type: "Darwin", name: "Mac OS X", architecture: "x86_64", version: "17.7.0" } }
2019-02-13T19:16:07.667-0500 I NETWORK  [conn1] end connection 127.0.0.1:51615 (0 connections now open)
2019-02-13T19:16:10.633-0500 I NETWORK  [listener] connection accepted from 127.0.0.1:51619 #2 (1 connection now open)
2019-02-13T19:16:10.633-0500 I NETWORK  [conn2] received client metadata from 127.0.0.1:51619 conn2: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.3" }, os: { type: "Darwin", name: "Mac OS X", architecture: "x86_64", version: "17.7.0" } }
2019-02-13T20:32:16.493-0500 I STORAGE  [conn2] createCollection: mongoBasics.post with generated UUID: 2f173ec9-d21d-4e0e-b207-7bb3b28d37ac

and this is my second terminal window: I just started this course, but i wanted to ask why did we need to run mongo on 2 terminal windows?

mongo

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()
---

> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
> use mongoBasics
switched to db mongoBasics
> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
> db.post.insert({title: "hooray!"})
WriteResult({ "nInserted" : 1 })
> show dbs
admin        0.000GB
config       0.000GB
local        0.000GB
mongoBasics  0.000GB
> show collections
post
> db.post.find()
{ "_id" : ObjectId("5c64c52078552a593d66f5eb"), "title" : "hooray!" }
> 

1 Answer

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Erik;

Congrats! You have a local MongoDB Server running on your machine. That's awesome.

The Access Control statement simply means that you have not setup users and user permissions on this server. Therefore, if it were running in a public facing situation, anyone could have read/write access to the database. That's not an ideal situation for a production environment so MongoDB now provides that message. Setting up users and permissions is definitely something to think about when you move to a production situation.

As for the 2nd terminal window, the first window is running the MongoDB Server instance. Once connections are made to that instance and operations start happening on it, you'll see additional log type information appear. There isn't a way to run that service in a terminal window and then, in the same window, launch the MongoDB Shell. Hence the need for the second window so that you can interact with the database from the command line.

Post back if you have any further questions and happy coding!

Ken