top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is default database in MangoDB?

+2 votes
308 views
What is default database in MangoDB?
posted Jul 13, 2015 by Amit Kumar Pandey

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Default database is test and can we change by making changes in mongorc.js file.
You can select the database to use on the mongo command line, eg for 'ourDB':

mongo ourDB

If a database name is not provided, 'test' will be used.
In .mongorc.js
If you want to set a default database without specifying on the command line each time, you can add a line to the .mongorc.js file in your home directory:

db = db.getSiblingDB("ourDB");
answer Feb 7, 2016 by Shivam Kumar Pandey
Similar Questions
+1 vote

I have a collection (say X) in mongodb replicaset which is updated quite frequently. X is part of a database where there are about 10-12 collections with usePowerodfSize enabled but collection X does not have this setting enabled. After enabling usepowerof2size on other collections I have started noticing "key seems to have moved in the index, refinding. 71:4ca18000" error show up very often. Every time this happens, the disk I/o shoots up very high, mongodb process starts running very hot. As a result the connection to other members of the replicaset starts getting affected and they go completely out of sync.

I read some articles online saying that "key seems to have moved" if printed very in-frequently can be ignored. But no where i found an answer to what if this shows up very frequently and what does this indicate.

Any help would be greatly appreciated. (I use mongodb 2.4.9Everything i have mentioned above is as observed from the PRIMARY logs.)

+1 vote

We are running MongoDB 3.0 with wiredTiger storage engine and wiredTigerCacheSizeGB is 24.
Now, I want to increase the wiredTigerCacheSizeGB value from 24 to 32. Is it possible to increase this variable without restart the service ?

...