Skip to content

Nodebb: failed to restore a mongo dump

Solved Configure
  • hello @phenomlab

    i want to restore my production db mongo backup to my dev environnement

    I have set the same ID/password for mongo admin users, same user for same database name and same password.

    Hhere is the file of the dump

    root@nodebbpwclonedb:/home/nodebb/nodebb_DB_20230107/nodebb# ls -lsah
    total 1,6G
    4,0K drwxr-xr-x 2 nodebb nodebb 4,0K  7 janv. 23:09 .
    4,0K drwxr-xr-x 3 nodebb nodebb 4,0K  7 janv. 23:08 ..
    1,5G -rw-r--r-- 1 nodebb nodebb 1,5G  7 janv. 03:30 objects.bson
    4,0K -rw-r--r-- 1 nodebb nodebb  603  7 janv. 03:30 objects.metadata.json
     18M -rw-r--r-- 1 nodebb nodebb  18M  7 janv. 03:30 searchpost.bson
    4,0K -rw-r--r-- 1 nodebb nodebb  492  7 janv. 03:30 searchpost.metadata.json
    276K -rw-r--r-- 1 nodebb nodebb 275K  7 janv. 03:30 searchtopic.bson
    4,0K -rw-r--r-- 1 nodebb nodebb  493  7 janv. 03:30 searchtopic.metadata.json
       0 -rw-r--r-- 1 nodebb nodebb    0  7 janv. 03:30 sessions.bson
    4,0K -rw-r--r-- 1 nodebb nodebb  314  7 janv. 03:30 sessions.metadata.json
    

    and the command I use for restore with the result :

    nodebb@nodebbpwclonedb:~/nodebb$ sudo mongorestore --username admin --password XXXXXXXXXXXXXXX --nsInclude nodebb.objects --drop /home/nodebb/nodebb_DB_20230107/nodebb/
    [sudo] Mot de passe de nodebb : 
    2023-01-07T23:14:07.617+0100    preparing collections to restore from
    2023-01-07T23:14:07.617+0100    don't know what to do with file "/home/nodebb/nodebb_DB_20230107/nodebb/objects.bson", skipping...
    2023-01-07T23:14:07.617+0100    don't know what to do with file "/home/nodebb/nodebb_DB_20230107/nodebb/objects.metadata.json", skipping...
    2023-01-07T23:14:07.617+0100    don't know what to do with file "/home/nodebb/nodebb_DB_20230107/nodebb/searchpost.bson", skipping...
    2023-01-07T23:14:07.617+0100    don't know what to do with file "/home/nodebb/nodebb_DB_20230107/nodebb/searchpost.metadata.json", skipping...
    2023-01-07T23:14:07.617+0100    don't know what to do with file "/home/nodebb/nodebb_DB_20230107/nodebb/searchtopic.bson", skipping...
    2023-01-07T23:14:07.617+0100    don't know what to do with file "/home/nodebb/nodebb_DB_20230107/nodebb/searchtopic.metadata.json", skipping...
    2023-01-07T23:14:07.617+0100    don't know what to do with file "/home/nodebb/nodebb_DB_20230107/nodebb/sessions.bson", skipping...
    2023-01-07T23:14:07.617+0100    don't know what to do with file "/home/nodebb/nodebb_DB_20230107/nodebb/sessions.metadata.json", skipping...
    2023-01-07T23:14:07.617+0100    0 document(s) restored successfully. 0 document(s) failed to restore.
    

    grrrrrrr

  • @phenomlab

    In fact I specified the sub rep and not the rep

    DON’T DO THIS:

    nodebb@nodebbpwclonedb:~/nodebb$ sudo mongorestore --username admin --password XXXXXXXXXXXXXX --nsInclude nodebb.objects --drop /home/nodebb/nodebb_DB_20230107/nodebb/
    

    BUT THIS :

    nodebb@nodebbpwclonedb:~/nodebb$ sudo mongorestore --username admin --password XXXXXXXXXXXXXX --nsInclude nodebb.objects --drop /home/nodebb/nodebb_DB_20230107/
    

    🙂

  • DownPWundefined DownPW has marked this topic as solved on

Did this solution help you?
Did you find the suggested solution useful? Why not buy me a coffee? It's a nice gesture, and a great way to show your appreciation 💗