Arc
Arc

Reputation: 11306

Is a Mongo ObjectId string representation guaranteed to be hexadecimal?

According to Mongo documentation on ObjectId(), the string representation seems to be hexadecimal right now, and trying to initialize an ObjectId() with a non-hexadecimal string of wrong length leads to failure.

Is this guaranteed to be this way? Can I rely on an ObjectId() to be a hexadecimal string for the foreseeable future?

Upvotes: 0

Views: 323

Answers (1)

Nikhil
Nikhil

Reputation: 83

I have been using MongoDB for the past 4 years. I dont think that they will be changing this basic functionality in any of the future releases. If they do that, lots of code will not be backward compatible and will break huge number of softwares.

Upvotes: 2

Related Questions