I have a Rocketchat running on a Windows server with docker that was formated and i don't know what was the image versions of mongo and Rocketchat.
I made a mongodump on my rocketchat docker database before the server was formated.
But now, with the Ubuntu 16.04 installed on the server and MongoDb 3.4.10, when i did a mongorestore:
mongorestore --db rocketchat --drop /data/rocketchat --batchSize=50
this error shows up:
2017-11-23T13:52:29.715+0000 Failed: rocketchat.rocketchat_uploads.files: error creating indexes for rocketchat.rocketchat_uploads.files: createIndex error: The field 'w' is not valid for an index specification. Specification: { name: "filename_1", ns: "rocketchat.rocketchat_uploads.files", w: 1, key: { filename: 1 } }
Searching on the internet, i ended up with this:
mongorestore --db rocketchat --noIndexRestore --drop /data/rocketchat --batchSize=50
Now i can login, but all the messages conversations get this error:
No Named User "Jeferson-Simao" was found!
There's a way to remake the indexes or restore db without error?
Here's the commands i used to dump:
docker exec -it md_mongo_1 mongodump -h localhost -d rocketchat
docker cp md_mongo_1:dump/rocketchat
Restore:
docker exec -it md_mongo_1 /bin/bash
mongorestore --db rocketchat /data/rocketchat --batchSize=50
Okay, it was easy.
I Just downgraded mongodb to 3.2 and it works.
No need to downgrade though...
Just don't restore the indices with the data:
mongorestore --host "mongodb:27017" --drop --noIndexRestore --db rocketchat ...
You might need to recreate the indices right after with the reIndex command.
Most helpful comment
No need to downgrade though...
Just don't restore the indices with the data:
mongorestore --host "mongodb:27017" --drop --noIndexRestore --db rocketchat ...You might need to recreate the indices right after with the reIndex command.