Difference between revisions of "MongoDB StartingMongoDB"

From mi-linux
Jump to navigationJump to search
Line 8: Line 8:
  
 
<pre style="color:blue">
 
<pre style="color:blue">
cs-student$
+
csl-student$
 
</pre>
 
</pre>
  
Line 38: Line 38:
  
 
  mongo db1612345  --port 27017 -u 1612345 -p myMongoPwd -whatever_options_are_required
 
  mongo db1612345  --port 27017 -u 1612345 -p myMongoPwd -whatever_options_are_required
 +
 +
 +
== Exiting MongoDB ==
 +
 +
To leave MongoDB type:
 +
 +
exit
  
 
== Changing Password ==
 
== Changing Password ==

Revision as of 13:18, 27 October 2016

Main Page >> MongoDB >>MongoDB Workbook >> Starting MongoDB

Once you have logged on to mi-linux.wlv.ac.uk you can then access MongoDB

Starting MongoDB

Once logged into the server, you should see the Linux prompt:

csl-student$

MongoDB can be started in several ways from the Linux prompt:

First time

To start MongoDB type:

runMongo

This runs with a default password, that should be changed when you first login (see below).

With Password

Once you have changed your password:

runMongo yourPassword

Using mongo directly

runMongo is a script file setup for your convenience that runs the mongo command and logs you into your own database.

If you need to use any of the other mongo options for any reason, you will need to run mongo directly:

mongo dbYourStudentNumber --port 27017 -u yourStudentNumber  -p yourMongoPassword -whatever_options_are_required

For example, if yourStudentNumber is 1612345 and MongoDB password is myMongoPwd then you would login as:

mongo db1612345  --port 27017 -u 1612345 -p myMongoPwd -whatever_options_are_required


Exiting MongoDB

To leave MongoDB type:

exit

Changing Password

Once you have logged into MongoDB successfully you can change the default password:

db.updateUser("myStudentNumber",
{
    pwd: "myNewPassword",
 }
);


Replacing myStudentNumber with your University student number and myNewPassword with your new password.

Note, the function names in MongoDB are case sensitive.

Next Step

Return to Getting Started.