最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Why do all Object IDs in MongoDB start with the number 5? - Stack Overflow

programmeradmin1浏览0评论

I've noticed that all MongoDB ids that have been generated in my webapp so far start with the number 5. For example, 54fb5359b903f0340d000006 and 54fca4664679861c17000002. Why is that the case?

I've noticed that all MongoDB ids that have been generated in my webapp so far start with the number 5. For example, 54fb5359b903f0340d000006 and 54fca4664679861c17000002. Why is that the case?

Share Improve this question edited Sep 22, 2017 at 17:57 CommunityBot 11 silver badge asked Mar 9, 2015 at 21:40 Nathan L.Nathan L. 2532 silver badges10 bronze badges 1
  • now they all start with 6! Someday you can tell your kids you are old enough to remember when object IDs started with a 5. :) – Kip Commented Apr 1, 2022 at 14:18
Add a ment  | 

1 Answer 1

Reset to default 12

Mongo uses a specific algorithm to generate the IDs based on several underlying factors.

http://docs.mongodb/manual/reference/object-id/

For example, it looks like the first few bytes are a timestamp, something which will have the same first digit for quite some time.

发布评论

评论列表(0)

  1. 暂无评论