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

Loading MongoDB correctly

Hi,

Currently I can only load MongoDB by using 'sudo mongod' - I have heard this is not best practice as it can problems later down the line. I have set my permissions for the database to be both read and write but on calling 'mongod' via the terminal, I get a number of permission denied errors as it attempts to start up followed by:

***aborting after fassert() failure

Any ideas what I should be doing or what the cause is?

1 Answer

Chris Shaw
Chris Shaw
26,676 Points

Hi Michael Constantinou,

I assume you are using macOS which the below guide explains.

http://treehouse.github.io/installation-guides/mac/mongo-mac.html

If you aren't, sudo would be required if you aren't using the root user. The reason for this is because the mongodb daemon needs to read and write in system protected folders that normal users have no access to.

Using sudo isn't dangerous when used correctly and in modern server management sudo is the standard way of managing software within the OS since it provides a secure gateway for managing the system without exposing the root user which is dangerous.

Hope that helps!

Thanks for the thorough explanation Chris, it's much appreciated.