Displays all the databases on MongoDB
Answer:
To display all the active databases on a MongoDB server, type
show dbs
To use it, like MySQL, try
use test
(Assume you need to use the test db)
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Displays all the databases on MongoDB
Answer:
To display all the active databases on a MongoDB server, type
show dbs
To use it, like MySQL, try
use test
(Assume you need to use the test db)
Create an index on a document in MongoDB
Answer:
To create an index on a document in MongoDB, you can enter the shell and execute the statement like:
db.test.ensureIndex({ "fieldName": 1 })
(Assume you need to create index on fieldName of the test collection.)
That's easy?
Swap last two characters in Bash
Answer:
Sometimes it is easy to mis-type characters in the wrong order, e.g. typed "sl" instead of "ls"
To swap it, use the little know Bash's trick: Ctrl + t
E.g.
# sl
[Ctrl + t]
Setting up a username in Mercurial
Answer:
To setup your Mercurial's username, you need to create the file .hgrc in your home folder,
e.g.
# touch ~/.hgrc
And add the following lines:
[ui]
username = John Doe <[email protected]>
Allow a remote IP for incoming connection in UFW (Uncomplicated firewall)
Answer:
To allow a remote IP for incoming connection in Ubuntu's UFW (Uncomplicated firewall), you can use the following command:
# sudo ufw allow from x.x.x.x
Of course you need to reload the firewall.
# sudo ufw reload