Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Mongorestore not restoring data

$
0
0

I have an existing mongodump of a single collection that I am trying to restore. After running mongo restore, no errors show up and the data is not in the collection. Are there any known reasons how this could happen? I would expect if the data weren't inserted for some reason, an error would be provided in the log.

To create and attempt to restore the dump, I followed the answer provided for this question:How to use mongodump for 1 collection

I've created a new database on a different server and it has an empty collection. I've checked the mongo log file and there are no errors, it shows the connection open and authenticate, then disconnect on the next line.

mongorestore -vvvvv -u user -p 'password' --db=MyDatabase --collection=MyCollection dump1/MyCollection.bson 2015-03-04T18:20:31.331+0000 creating new connection to:127.0.0.1:270172015-03-04T18:20:31.332+0000 [ConnectBG] BackgroundJob starting: ConnectBG2015-03-04T18:20:31.332+0000 connected to server 127.0.0.1:27017 (127.0.0.1)2015-03-04T18:20:31.332+0000 connected connection!connected to: 127.0.0.12015-03-04T18:20:31.333+0000 drillDown: dump1/MyCollection.bson2015-03-04T18:20:31.333+0000 dump1/MyCollection.bson2015-03-04T18:20:31.333+0000    going into namespace [MyDatabase.MyCollection]Restoring to MyDatabase.MyCollection without dropping. Restored data will be inserted without raising errors; check your server log         file size: 94876130 objects found2015-03-04T18:20:31.336+0000    Creating index: { key: { _id: 1 }, name: "_id_", ns: "MyDatabase.MyCollection" }2015-03-04T18:20:31.340+0000    Creating index: { key: { geometry: "2dsphere" }, name: "geometry_2dsphere", ns: "MyDatabase.MyCollection", 2dsphereIndexVersion: 2 }

Log file:

2015-03-04T18:20:31.333+0000 [conn874]  authenticate db: MyDatabase { authenticate: 1, nonce: "xxx", user: "user", key: "xxx" }2015-03-04T18:20:31.342+0000 [conn874] end connection 127.0.0.1:59420 (25 connections now open)

The query I am using on the origin and destination is:

db.MyCollection.find()

On the origin server, the collection has 130 elements, which is what is also shown in the mongorestore output "130 objects found".

Edit:

I added the --drop option to the mongorestore command. The log file output clearly shows that it is creating the index on an empty collection.

2015-03-20T15:03:57.565+0000 [conn61965]  authenticate db: MyDatabase { authenticate: 1, nonce: "xxx", user: "user", key: "xxx" }2015-03-20T15:03:57.566+0000 [conn61965] CMD: drop MyDatabase.MyCollection2015-03-20T15:03:57.631+0000 [conn61965] build index on: MyDatabase.MyCollection properties: { v: 1, key: { _id: 1 }, name: "_id_", ns: "MyDatabase.MyCollection" }2015-03-20T15:03:57.631+0000 [conn61965]         added index to empty collection2015-03-20T15:03:57.652+0000 [conn61965] build index on: MyDatabase.MyCollection properties: { v: 1, key: { geometry: "2dsphere" }, name: "geometry_2dsphere", ns: "MyDatabase.MyCollection", 2dsphereIndexVersion: 2 }2015-03-20T15:03:57.652+0000 [conn61965]         added index to empty collection2015-03-20T15:03:57.654+0000 [conn61965] end connection 127.0.0.1:59456 (21 connections now open)

Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>