I want to hack ObjectId by manipulating the machineId like this:
<timestamp> <machineId> <processId> <inc>
UserId XXXXXXXX XXXX01 XXXX XXXXXX
OrderId XXXXXXXX XXXX02 XXXX XXXXXX
CardId XXXXXXXX XXXX03 XXXX XXXXXX
...
the basic idea is to use 1 byte of machineId to distinguish the object type, my question is: is there any problem when doing so (considering uniqueness and sharding)?
--- update on Dec 9 ---
Due to the difference between the spec and implementation Why the bson java implementation uses 4 bytes inc field?, I'm going to change my solution a bit to following style:
<timestamp> <machineId> <processId> <inc>
UserId XXXXXXXX XXXX XXXX 01XXXXXX
OrderId XXXXXXXX XXXX XXXX 02XXXXXX
CardId XXXXXXXX XXXX XXXX 03XXXXXX
...