TransactionTime()

Get the query transaction time.

Signature

TransactionTime() => TransactionTime

Description

The TransactionTime is a placeholder that is set when the query is committed. If the query doesn’t write, it is equivalent to the query snapshot time, Time.now().

Parameters

None

Return value

Type Description

TransactionTime

ISO 8601 time value.

Examples

This example shows the transaction time, ts, is the TransactionTime().

let doc = Customer.create({
  name: "John Doe",
  email: "jdoe@example.com",
  address: {
    street: "87856 Mendota Court",
    city: "Washington",
    state: "DC",
    postalCode: "20220",
    country: "US"
  }
})
[doc, doc.ts == TransactionTime()]
[
  {
    id: "412735829984673869",
    coll: Customer,
    ts: Time("2024-10-25T16:40:10.525Z"),
    cart: null,
    orders: "hdWCxmVPcmRlcoHKhGpieUN1c3RvbWVygcZidjD09oHNSgW6VQz0UABNBAD2wYIaZxvJ6hofSt1AEA==",
    name: "John Doe",
    email: "jdoe@example.com",
    address: {
      street: "87856 Mendota Court",
      city: "Washington",
      state: "DC",
      postalCode: "20220",
      country: "US"
    }
  },
  true
]

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!