Search code examples
faunadb

How can I get a change history of faunaDB document?


FaunaDB's At() function looks so nice! I wonder if I can log a time series of sensor data into one document, and draw a time series chart by At() function and change history of the document.

So, is there any way to get a change history of FaunaDB's documents? Thank you for your suggestion!


Solution

  • Events($ref) will give you the history of a document. The amount of retained history is configurable. The complete docs for Event is found here.

    That said I'm not sure I'd choose to implement a sensor time series that way. I'd be more inclined to write a separate document per reading. Mostly because it's easier to work with first class values for time series and if you need to record quickly you won't run into conflicts.