I'm moving a website and Mongo database to a new server.
Website can't see the data.
Mongo is installed and running on the same server.
Shell and server are both 3.6.3
Mongo shell sees the database.
From the shell,
dbs returns the database name.
use dbname appears to work.
db.getCollectionNames() returns a reasonable collection name. Say ["myCollection"]
.
db.getCollection("myColection").getIndexes() returns
[ { "v" : 2, "key" : { "_id" : 1 }, "name" : "id", "ns" : "myDB.myCollection" } ]
But after that, I can't get any further.
db.myCollection.find() and
db.getCollection("myCollection").find() both return nothing.
Everything in the log looks correct, no errors.
Does that tell us anything?
version()anddb.version()in yourmongoshell? One possibility is that you are using a shell version that is much older than your MongoDB server version. - Stenniemongoshell version matches the server version (and both are 3.6.3), that should remove the possibility that the issue is with an older shell which hasn't been updated for the MongoDB 3.0+ storage engine API (which would exhibit similarly). Have you definitely restored your data into the correct database on your new server? Doesdb.myCollection.stats()have the expectedcountandsizeof documents? - Stennie