mongodb - How to convert from Timestamp to Mongo ObjectID -


i know can use gettimestamp() retrieve timestamp objectid, there way generate objectid timestamp?

more specifically, if have input of month , year, want convert mongo objectid query in db, how should this?

an objectid() 12-byte bson type , consists of:

  • the first 4 bytes representing seconds since unix epoch
  • the next 3 bytes machine identifier
  • the next 2 bytes consists of process id
  • the last 3 bytes random counter value

clearly, not able create objectid() timestamp.


Comments

Popular posts from this blog

Combining PHP Registration and Login into one class with multiple functions in one PHP file -

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -