0

I have a huge dataset of documents, but when I got the data, I forgot append a timestamp of the time were created each of them.

How I can use the ObjectID timestamp of each document to append the timestamp when were created for all of them?

Maxtrix
  • 495
  • 5
  • 14

1 Answers1

1

Sorry for the initial wrong answer.


That being said, the documentation says for python that, you can get the timestamp in EPOCH time in the first 4 bytes of your objectID.

I read somewhere else (here), that in Javascript, you have a method .getTimestamp(). You should tell us the language you need in order to get your function, but I guess you got the logic anyway. :)

IMCoins
  • 3,149
  • 1
  • 10
  • 25
  • Yes that was the way, with the python mongoDB library you can extract the date and then append it in the document. – Maxtrix Aug 07 '19 at 09:30
  • @Maxtrix That was an unexpected comment 1 year and a half later haha – IMCoins Aug 07 '19 at 09:35
  • I forgot totally about my account and I just realized that your answer was the thing that I used at that time. – Maxtrix Aug 07 '19 at 09:40