Home > Blockchain >  Mongorestore finished restore success. But compass and mongo shows 0 documents
Mongorestore finished restore success. But compass and mongo shows 0 documents

Time:01-23

OEL 7.9. MongoDB 4.2.23

I tried to restore the db:

mongorestore --nsInclude="mfm-data.*" --archive=/oradata/backup/mongo/mobile/mongo-mobile_backup_20221221_000002.tar

(There are many other cluster databases in the archive. Size 18 GB)

*

preparing collections to restore from
restoring to existing collection mfm-data.communication without dropping
reading metadata for mfm-data.communication from archive '/oradata/backup/mongo/mobile/mongo-mobile_backup_20221221_000002.tar'
restoring mfm-data.communication from archive '/oradata/backup/mongo/mobile/mongo-mobile_backup_20221221_000002.tar'
mfm-data.communication 66.4MB
...
mfm-data.communication 5.18GB
restoring indexes for collection mfm-data.communication from metadata
finished restoring mfm-data.communication (19098 documents, 0 failures)
restoring to existing collection mfm-data.imageInfo without dropping
reading metadata for mfm-data.imageInfo from archive '/oradata/backup/mongo/mobile/mongo-mobile_backup_20221221_000002.tar'
restoring mfm-data.imageInfo from archive '/oradata/backup/mongo/mobile/mongo-mobile_backup_20221221_000002.tar'
restoring indexes for collection mfm-data.imageInfo from metadata
finished restoring mfm-data.imageInfo (0 documents, 0 failures)
19098 document(s) restored successfully. 0 document(s) failed to restore.

But... *

use mfm-data
switched to db mfm-data
MongoDB Enterprise > show collections;
communication
imageInfo
MongoDB Enterprise > db.communication.count();
0

Help, please.

I tried to use another client for restore, it did not help.

CodePudding user response:

My issue is resolved. An index has been created for the collection with the parameter:

"expireAfterSeconds":86400.0

I didn't have information about the structure of the collection. From logfile:

INDEX [conn6743] index build: starting on mfm-data.communication properties: { v: 2, key: { withdrawalDate: 1 }, name: "withdrawalDate", ns: "mobile-mfm-data.communication", expireAfterSeconds: 86400 }

To resolve this issue, added the option for mongorestore:

--noIndexRestore

Or changing index details in metadatafile.

  • Related