ObjectID does not store hex value

Initially, my Sails / Mongo stored ObjectID in the database as follows:

"_id" : ObjectId("557077fb836bdee256004232") 

I don’t know what has changed or happened, but now the new records are stored as follows:

 "_id" : { "_bsontype" : "ObjectID", "id" : "UtÓ-Åß\u0010C&5", "generationTime" : 1434552692 } 

This only happens in 2 out of 6 development environments.

Things I checked:

  • Return to stable commit from last week, cleared node_modules, npm cache, etc. Reinstalled and no luck.
  • Node / npm / MongoDB has been completely updated to make sure that I am in the latest stable version of everything ... my versions correspond to existing development environments that work without problems.

I would be more than happy to share the configuration / logs if there is anything specific that could help. Environment: Node 0.12.4, npm v2.11.2, shell MongoDB v3.0.4. I debugged the code and everything to such an extent that I am sure that it is something unique for my environment and how it interacts with Mongo / Sails / Waterline / BSON.

I hope this is more of a question “Hey, I saw it before, and that's how I decided”, and not a question with code or debugging! Thanks!

+2
source share
1 answer

Answering my question!

Something seemed to be happening with the installation of MongoDB brew. Manually reinstalling it from http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/ and then restoring the database backup seems like a trick.

I would still like to learn from the code / technical point of view why my environment suddenly decided to start returning a 12-byte BSON ObjectID and not a hexadecimal ObjectID ... but until then, we hope that a simple manual reset will help others who encounter with this strange problem!

+2
source

All Articles