I had an existing Django nonrel application using MongoDB. Seemed that the related fields of objects are stored by ObjectIDs. For example, I have an UserProfile model which relates to User objects by OneToOneField. And the stored objects data was like:
{
"_id": {
"$oid": "4f67540040e0460001000001"
},
"user_id": {
"$oid": "4f67540040e0460001000000"
},
....
}
I deployed the application on Heroku which uses git repository to fetch django nonrel projects and django-mongodb-engine. The pymongo version I used is 2.1.1. I am not sure because of the update of which library, I found that the related fields seems not stored by ObjectId anymore. New objects data is stored like:
{
"_id": {
"$oid": "4f67540040e0460001000001"
},
"user_id": "4f67540040e0460001000000",
....
}
The problem is it causes errors due to data format inconsistency. Not only I couldn't get related object of previously stored objects (getting "DoesNotExist: UserProfile matching query does not exist."). Related objects of newly saved objects couldn't be fetched by Piston as well.
I tried to add revision specifier to git repository URLs in requirements.txt but had no luck, which is weird.
Does anyone know about what was going on? Perhaps I have to do a mongoDB data update to fix those related data id values?
What version were you using previously? - Need to know django-nonrel / djangotoolbox versions as well.
Seems like you might have to manually migrate the data - but it would be good to nail down the revision where the change happened to ensure its not a transient change.