couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick North <nort...@gmail.com>
Subject Re: Automatic Unix Timestamp
Date Fri, 26 Jul 2013 15:48:24 GMT
If you're prepared to let the server assign the document id, you could use
the utc_random or utc_suffix UUID algorithms, which create a document id
incorporating the number of microseconds since 1 Jan 1970 as the first 14
hex characters. Of course that doesn't work if you want to allow document
revisions with updated timestamps.

Nick


On 26 July 2013 16:36, Hank Knight <hknight555@gmail.com> wrote:

> How can I add a Unix Timestamp to a document, based on the server's clock?
>
> This gives me an error:
> JSON.parse: unexpected character
>
> {
>  "_id":"12345",
>  "user":"joe",
>  "unixtimestamp": Math.round(new Date().getTime()/1000),
>  "fruit":"peach"
> }
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message