mongodbmongohqcompose-db

Are Mongo ObjectID's Supposed To Spell Words?


I was doing some work today when I noticed something strange in one of my MongoDB documents:

The Owls Are Not What They Seem

Is it normal for Mongo to spell words within an ObjectID or is this indicative that there's an issue with the randomization that generates the _id field?

I'm going to keep an eye on this, but if anyone has any info on whether this should be concerning or not thanks in advance for any help.


Solution

  • Well it's nothing but just a funny easter egg of no serious intention. Welcome to the 25th of august.

    The pure chance here is that "53facade" just happens to correspond to epoch time as of:

    "Mon, 25 Aug 2014 05:34:22 GMT".

    Looking at the whole part of this:

    ObjectId is a 12-byte BSON type, constructed using:

    • a 4-byte value representing the seconds since the Unix epoch,
    • a 3-byte machine identifier,
    • a 2-byte process id, and
    • a 3-byte counter, starting with a random value.

    So that opening 4-btye representation ( which is valid hex in all characters ) is derived from the current timestamp values when created, just happening to be 1408944862 when this happened.

    Nothing more than a co-incidence and totally valid. As you can see though, it is the "rest" of the identifier that determines the "randomness" and indeed "unique" attributes of the ObjectId, as all ObjectId values created at this time would say the same for an interval of 1000 miliseconds.

    No error or weakness here, just an amusing point in the day.