Learning Notes MongoDB--Objectid composition Analysis

Source: Internet
Author: User
Tags unique id

This paper mainly records how the MONGO auto-generated Objectid is formed.

Take a objectid as an example: 5996B6DE8E4F89047CEF0FEC

There are a total of 24 bits of 16 binary numbers, which is 12 bytes.

Where the first four bytes represent the current timestamp: 5996b6de

Then three bytes represents your host unique ID: 8e4f89

The following two bytes represent the process identifier (PID):047c

The last three bytes are a self-increasing random number: EF0FEC,

For example, a line range insert three data, the generated Objectid is: 5996bbc68e4f891e98d9485c,

5996BBC68E4F891E98D9485D,

5996bbc68e4f891e98d9485e

Learning Notes MongoDB--Objectid composition Analysis

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.