New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creation time guessed from ObjectID #55

Closed
heruan opened this Issue Nov 14, 2012 · 2 comments

Comments

Projects
None yet
2 participants
@heruan

heruan commented Nov 14, 2012

I noticed that the document's creation time displayed is guessed in Genghis by parsing the ObjectID, since a default MongoDB ObjectID has the first 4 bytes representing the timestamp the ObjectID was created at.
It may be a nice feature, but one can use custom values in ObjectIDs resulting in awkward dates displayed in Genghis:

Genghis
2 documents
==========
7b694dc93a35bb44f4d31124 Sun, 12 Aug 2035 02:32:41 GMT
{
  _id: ObjectId("7b694dc93a35bb44f4d31124"),
  ...
}
0862b01e825494dc728b437e Mon, 17 Jun 1974 07:15:42 GMT
{
  _id: ObjectId("0862b01e825494dc728b437e"),
  ...
}

Can this behaviour be disabled in cases where the guess would be wrong?

@bobthecow

This comment has been minimized.

Show comment
Hide comment
@bobthecow

bobthecow Nov 16, 2012

Owner

Yep, this is weird. I'd like to support this use case, but I'd also love to avoid adding a setting to support it, so what would be a reasonable heuristic for deciding whether to show a creation timestamp?

Owner

bobthecow commented Nov 16, 2012

Yep, this is weird. I'd like to support this use case, but I'd also love to avoid adding a setting to support it, so what would be a reasonable heuristic for deciding whether to show a creation timestamp?

@bobthecow bobthecow closed this in c00e716 Nov 22, 2012

@bobthecow

This comment has been minimized.

Show comment
Hide comment
@bobthecow

bobthecow Nov 22, 2012

Owner

Here's the heuristic I settled on:

  • Only guess creation date if all documents in the current page of the current collection which have ObjectIds as their _id also have "sane" ObjectId timestamps
  • A "sane" ObjectId timestamp is a timestamp timestamp created from the first four bytes of the ObjectId which is before 48 hours from now (leaving some room for time zones and server timestamp craziness?) and after the release of Mongo v1.0.

This change has been committed to develop and will be in the next release!

Owner

bobthecow commented Nov 22, 2012

Here's the heuristic I settled on:

  • Only guess creation date if all documents in the current page of the current collection which have ObjectIds as their _id also have "sane" ObjectId timestamps
  • A "sane" ObjectId timestamp is a timestamp timestamp created from the first four bytes of the ObjectId which is before 48 hours from now (leaving some room for time zones and server timestamp craziness?) and after the release of Mongo v1.0.

This change has been committed to develop and will be in the next release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment