parse-bson-objectid
Parse parts of a BSON ObjectId
Last updated 5 years ago by parshap .
WTFPL · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install parse-bson-objectid 
SYNC missed versions from official npm registry.

parse-bson-objectid

Parse parts of a MongoDB BSON ObjectId:

  • timestamp: 4-byte timestamp (Number, big-endian signed integer)
  • machine: 3-byte machine identifier (Buffer, byte sequence)
  • pid: 2-byte process id (Number, big-endian unsigned integer)
  • counter: 3-byte counter (Number, big-endian unsigned integer)

Install

npm: parse-bson-objectid

npm install parse-bson-objectid

Example

> var parse = require("parse-bson-objectid");
> parse("564b86ef165bd87b6e595515")
{ timestamp: 1447790319,
  machine: <Buffer 16 5b d8>,
  pid: 31598,
  counter: 5854485 }

API

var parse = require("parse-bson-objectid");

parse(objectid)

Parse an objectid into individual ObjectID parts. objectid can be given as:

  • A buffer
  • A hex string
  • An instance of ObjectId (any object with .toHexString() function)

Current Tags

  • 1.0.1                                ...           latest (5 years ago)

2 Versions

  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (2)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |