Skip to content

Commit

Permalink
Dislaimer on using Now() in bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
fauna-brecht committed Jul 7, 2020
1 parent 764045d commit 97899c8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/fauna/setup/fweets.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ const CreateIndexFweetsByTag = CreateIndex({
likes: Select(['data', 'likes'], Var('fweet')),
comments: Select(['data', 'comments'], Var('fweet')),
refweets: Select(['data', 'refweets'], Var('fweet')),

// DISCLAIMER !!!!
// Now() should not be used in bindings since it does not provide correct results,
// Something I did not know at the time of writing.
// Instead please use either a created_at time you store on the document
// or an updated time instead. We'll update the app from the moment I find time to test
// an alternative approach.

txtime: Now(),
unixstarttime: Time('1970-01-01T00:00:00+00:00'),
ageInSecsSinceUnix: TimeDiff(Var('unixstarttime'), Var('txtime'), 'minutes')
Expand Down

0 comments on commit 97899c8

Please sign in to comment.