Tuesday, December 10, 2013

MongoDB export import example

EXPORT EXAMPLE

root@ubuntu:/var# mongodump --db test
connected to: 127.0.0.1
DATABASE: test to dump/test
test.system.indexes to dump/test/system.indexes.bson
7 objects
test.profiles to dump/test/profiles.bson
8 objects
test.fs.chunks to dump/test/fs.chunks.bson
3 objects
test.fs.files to dump/test/fs.files.bson
3 objects
test.mys to dump/test/mys.bson
1 objects
test.myContents to dump/test/myContents.bson
95 objects
test.yourContents to dump/test/yourContents.bson
23 objects


IMPORT EXAMPLE

root@ubuntu:/var# mongorestore --db test dump/test
connected to: 127.0.0.1
dump/test/system.indexes.bson
going into namespace [test.system.indexes]
7 objects
dump/test/yourContents.bson
going into namespace [test.yourContents]
23 objects
dump/test/fs.files.bson
going into namespace [test.fs.files]
3 objects
dump/test/myContents.bson
going into namespace [test.myContents]
95 objects
dump/test/fs.chunks.bson
going into namespace [test.fs.chunks]
3 objects
dump/test/profiles.bson
going into namespace [test.profiles]
8 objects
dump/test/mys.bson
going into namespace [test.mys]
1 objects
root@ubuntu:/var#

1 comment: