Skip to content

objectid from mongodb is a sort of global unique identifier(guid)

Notifications You must be signed in to change notification settings

git-zhoujunyu/nobjectid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nobjectid

objectid from mongodb is a sort of global unique identifier(guid)

use

https://www.nuget.org/packages/nobjectid

using System;

namespace Demo
{
    class Program
    {
        static void Main(string[] args)
        {
            var id= ObjectId.GenerateNewId().ToString();

            Console.WriteLine(id);  //5a4c769ea719be0daca68075
        }
    }
}

the generated identifier consists of 24 characters, 12 bytes, according to the rules is divided into 4 parts:
[the timestamp (4 bytes) | machine id (3 bytes) | process id (2 bytes) | increment number (3 bytes)]

documentation please see: http://www.mongodb.org/display/DOCS/Object+IDs

About

objectid from mongodb is a sort of global unique identifier(guid)

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages