Question

Hi when I do a mongorestore to dump my database ok

if I had:

> show dbs
local   (empty)
test    0.203125GB

it became:

> show dbs
local   (empty)
test    0.203125GB
ok          0.203125GB

but if I do a db.getCollectionName() it just prints

> db.getCollectionNames()
[ "system.indexes", "test", "users" ]

I want ok to appear here, how can I do ?

thanks

Was it helpful?

Solution

Ok will never appear in the list of collections, because ok is a database, not a collection. Databases contain many collections, but aren't collections themselves.

To see the collections in the ok database, type use ok followed by db.getCollectionNames();.

If you want to backup and restore a single collection, then you'll need to use the --collection arguments to mongodump and mongorestore. See the documentation for more info.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top