stripe-archive / mosql

MongoDB → PostgreSQL streaming replication
MIT License
1.63k stars 225 forks source link

Pulling created date from the Objectid #110

Open sachmans opened 8 years ago

sachmans commented 8 years ago

HI,

I am trying to work out how to use a function like this getTimestamp() in the YAML or another way to get the date/time from the ObjectID for the particular document to know when it was created.

Any help on this would be greatly useful.

Sachin

BradRuderman commented 8 years ago

@sachmans I know this probably isn't ideal but you can pull it out with a query, perhaps even creating a function:

SELECT to_timestamp(('x' || lpad(substring(object_id,0,9), 8, '0'))::bit(32)::int)::timestamp ts FROM objects