After much experimentation and observation I can now more clearly describe what is happening here.
An internal database is created in a meteor app. Data is added, both through a fixture script and through normal use.
A mongodump is done.
A mongorestore is made to a mongod instance, this one is on 127.0.0.1:27017.
At this point, if you look at both databases using mongo shells, the are identical, the internal meteor database and the new meteor database on the mongod instance.
Fire up the meteor app using – MONGO_URL=“mongodb://localhost:27017/” meteor
As meteor connects to the mongod instance, a new “admin” database is created by mongo. This database is an exact copy of the meteor database, except that all the _ids have been recalculated. None of the original _ids exist here.
The app begins running on the admin database with all the new _ids, not the meteor database as expected. Of course these new _ids break connections all over the app, but also, only a subset of the data is written to the admin database. Only 14 of what were 18 records, for instance.
I would/am considering not using _ids to connect anything or find anything or for anything at all. In many developments before I’ve used a separate UUID, apart from the database row identifier. This way, if you have to change databases, the complication of maintaining the original row based id is alleviated. So, I’m not averse to doing this here, but it won’t solve 2 problems. First, I don’t have an easy way to add new fields to the user database (a UUID). I’m using the standard accounts packages and I’d rather not have to modify those packages. Second, only a subset of the data is being written to this admin database. And, of course, why is the app running on the admin database and not the meteor database?
I would appreciate any insight into this. Surely this cannot be the way that meteor intended? Can it?
Thanks in advance, Alex