Discussion:
mongorestore with --drop command isn't dropping collections
kellypw
2012-08-09 21:50:15 UTC
Permalink
Using version 2.0.5 on RH. For our nightly regression environment, we want
to restore a baseline 'dump' of a database with 2 collections in it each
time we re run our tests. When running the mongorestore for a single
database with the --drop command, it doesn't drop the existing
collections. Here's what the documentation states:

--drop

Modifies the restoration procedure to drop every collection from the target
database before restoring the collection from the dumped backup.

I've tested this multiple times and confirmed that my dump location for the
database has only the 2 .bson files I'm expecting to restore, yet the
existing collections are not dropped when I perform the restore.

Perhaps I'm mis-interpreting what the --drop command does?

TIA
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongodb-user-/***@public.gmane.org
To unsubscribe from this group, send email to
mongodb-user+unsubscribe-/***@public.gmane.org
See also the IRC channel -- freenode.net#mongodb
Scott Hernandez
2012-08-09 23:55:23 UTC
Permalink
Drop only drops the collections it is going to restore. Do you want
other collections dropped besides the ones you want to restore?
Post by kellypw
Using version 2.0.5 on RH. For our nightly regression environment, we want
to restore a baseline 'dump' of a database with 2 collections in it each
time we re run our tests. When running the mongorestore for a single
database with the --drop command, it doesn't drop the existing collections.
--drop
Modifies the restoration procedure to drop every collection from the target
database before restoring the collection from the dumped backup.
I've tested this multiple times and confirmed that my dump location for the
database has only the 2 .bson files I'm expecting to restore, yet the
existing collections are not dropped when I perform the restore.
Perhaps I'm mis-interpreting what the --drop command does?
TIA
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To unsubscribe from this group, send email to
See also the IRC channel -- freenode.net#mongodb
kellypw
2012-08-10 17:03:06 UTC
Permalink
Yes, I would like to drop all collections in the existing database and
restore only those in the dump. Will I need to write a script to do that?
Post by Scott Hernandez
Drop only drops the collections it is going to restore. Do you want
other collections dropped besides the ones you want to restore?
Post by kellypw
Using version 2.0.5 on RH. For our nightly regression environment, we
want
Post by kellypw
to restore a baseline 'dump' of a database with 2 collections in it each
time we re run our tests. When running the mongorestore for a single
database with the --drop command, it doesn't drop the existing
collections.
Post by kellypw
--drop
Modifies the restoration procedure to drop every collection from the
target
Post by kellypw
database before restoring the collection from the dumped backup.
I've tested this multiple times and confirmed that my dump location for
the
Post by kellypw
database has only the 2 .bson files I'm expecting to restore, yet the
existing collections are not dropped when I perform the restore.
Perhaps I'm mis-interpreting what the --drop command does?
TIA
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To unsubscribe from this group, send email to
See also the IRC channel -- freenode.net#mongodb
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongodb-user-/***@public.gmane.org
To unsubscribe from this group, send email to
mongodb-user+unsubscribe-/***@public.gmane.org
See also the IRC channel -- freenode.net#mongodb
Scott Hernandez
2012-08-10 18:56:15 UTC
Permalink
Yes, that would be a good idea. It will be faster if you drop the
database(s) than the collections one by one.
Post by kellypw
Yes, I would like to drop all collections in the existing database and
restore only those in the dump. Will I need to write a script to do that?
Post by Scott Hernandez
Drop only drops the collections it is going to restore. Do you want
other collections dropped besides the ones you want to restore?
Post by kellypw
Using version 2.0.5 on RH. For our nightly regression environment, we want
to restore a baseline 'dump' of a database with 2 collections in it each
time we re run our tests. When running the mongorestore for a single
database with the --drop command, it doesn't drop the existing collections.
--drop
Modifies the restoration procedure to drop every collection from the target
database before restoring the collection from the dumped backup.
I've tested this multiple times and confirmed that my dump location for the
database has only the 2 .bson files I'm expecting to restore, yet the
existing collections are not dropped when I perform the restore.
Perhaps I'm mis-interpreting what the --drop command does?
TIA
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To unsubscribe from this group, send email to
See also the IRC channel -- freenode.net#mongodb
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To unsubscribe from this group, send email to
See also the IRC channel -- freenode.net#mongodb
kellypw
2012-08-10 19:05:45 UTC
Permalink
I will do that instead. drop the database then restore. Thanks for the
response.
Post by Scott Hernandez
Yes, that would be a good idea. It will be faster if you drop the
database(s) than the collections one by one.
Post by kellypw
Yes, I would like to drop all collections in the existing database and
restore only those in the dump. Will I need to write a script to do
that?
Post by kellypw
Post by Scott Hernandez
Drop only drops the collections it is going to restore. Do you want
other collections dropped besides the ones you want to restore?
Post by kellypw
Using version 2.0.5 on RH. For our nightly regression environment,
we
Post by kellypw
Post by Scott Hernandez
Post by kellypw
want
to restore a baseline 'dump' of a database with 2 collections in it
each
Post by kellypw
Post by Scott Hernandez
Post by kellypw
time we re run our tests. When running the mongorestore for a single
database with the --drop command, it doesn't drop the existing collections.
--drop
Modifies the restoration procedure to drop every collection from the target
database before restoring the collection from the dumped backup.
I've tested this multiple times and confirmed that my dump location
for
Post by kellypw
Post by Scott Hernandez
Post by kellypw
the
database has only the 2 .bson files I'm expecting to restore, yet the
existing collections are not dropped when I perform the restore.
Perhaps I'm mis-interpreting what the --drop command does?
TIA
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To unsubscribe from this group, send email to
See also the IRC channel -- freenode.net#mongodb
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To unsubscribe from this group, send email to
See also the IRC channel -- freenode.net#mongodb
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongodb-user-/***@public.gmane.org
To unsubscribe from this group, send email to
mongodb-user+unsubscribe-/***@public.gmane.org
See also the IRC channel -- freenode.net#mongodb
Loading...