admin管理员组文章数量:1391951
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
1 Answer
Reset to default 12Mongo 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.
本文标签: javascriptWhy do all Object IDs in MongoDB start with the number 5Stack Overflow
版权声明:本文标题:javascript - Why do all Object IDs in MongoDB start with the number 5? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744715588a2621385.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论