The current _id generation strategy is not safe across restarts because it relies solely on the current millisecond and an in-memory counter that resets when the process exits.
A robust fix would be to stop overriding MongoDB's _id entirely, or derive _id deterministically from _key if the project truly needs a custom primary key.
The current _id generation strategy is not safe across restarts because it relies solely on the current millisecond and an in-memory counter that resets when the process exits.
A robust fix would be to stop overriding MongoDB's _id entirely, or derive _id deterministically from _key if the project truly needs a custom primary key.