How to change DBRef for MongoDB?

1.7k views Asked by At

So, I'm using MongoDB for a project an I have a server that was used to do all the testing for my site and I used DBRef on a few tables and this created something like this:

"comment": { "$ref": "user", "$id": ObjectId("xxxx"), "$db": "dev_server" }

And now we have a new server for the actual production site. Since we where working with real information we exported the DB and placed it into a new one called "prod_server". Now, the DBRef keeps like the one above. I've tried to update the value of the $db but i get this:

"comment": { "$db": "prod_server" "$id": ObjectId("xxxx"), "$ref": "user", }

And with this change the web crashes(mongo changes automatically to alphabetic order). I searched about this and found out that the order of the DBRef is important or else it won't work.

So that why the question: "How to change DBRef" and keep the right order? I used the console and rockmongo for this and none of them worked.

Thank you

0

There are 0 answers