Skip to main content

Posts

Showing posts with the label MongoDB

MongoDB error: An error occurred while deserializing the _id field of class … : Cannot deserialize string from BsonType ObjectId.

The last few weeks I’m having fun learning MongoDB . Having some experience with RavenDB , I hoped to re-use most of knowledge when building a MongoDB backend. However I have to conclude that no two No-SQL solutions are alike, so there is still a high learning curve. I created a sample application, but when I tried to load some objects from the database, I got the following error: An error occurred while deserializing the _id field of class Product: Cannot deserialize string from BsonType ObjectId. Let’s have a look at the object I was using; I have a Product class with 2 properties and an ‘_id’ field. The ‘_id’ field is automatically generated by MongoDB for every object you create. The problem is that behind the scenes MongoDB is storing all objects as BSON documents in the database. The ‘_id’ field isn’t an ordinary string but an ObjectId , a 12-byte BSON type, constructed using: a 4-byte value representing the seconds since the Unix epoch, a 3-byte machine id...

MongoDB: System error 1067 has occurred.

After installing MongoDB as a windows service I wasn’t able to get it started. Instead the following error message was shown: The Mongo DB service is starting. The Mongo DB service could not be started. A system error has occurred. System error 1067 has occurred. The process terminated unexpectedly. When MongoDB crashes like this, you have to do some clean up work before trying to start it again: Delete the following file inside the /data/db/ directory: mongod.lock mongod.exe –repair Start the mongod service again