Automatically add createdAt and updatedAt on each records?

I have

client.query(
  q.Create(
    q.Collection('users'),
    {
      data: {
        email,
        password,
        lastLogin: null,
        updatedAt: new Date(),
        createdAt: new Date()
      }
    }
  )
);

can updatedAt and createdAt be added and managed automatically so I don’t have to specify it?

updatedAt is the same as ts, and created at can be fetched by getting the ts from the first event. The downside is that it will require another read. That being said you could easily create your own “create” replacement using nothing but FQL.

const CreateCustom = (col, obj) => {
    return q.Let(
        { obj },
        q.Create(
            col,
            q.Merge(q.Var("obj"), {
                data: q.Merge(q.Select(["data"], q.Var("obj"), {}), {
                    createdAt: q.Now(),
                    updatedAt: q.Now(),
                }),
            })
        )
    )
}

const UpdateCustom = (ref, obj) => {
    return q.Let(
        { obj },
        q.Update(
            ref,
            q.Merge(q.Var("obj"), {
                data: q.Merge(q.Select(["data"], q.Var("obj"), {}), {
                    updatedAt: q.Now(),
                }),
            })
        )
    )
}

So, currently, no way to do this / enable this on fauna db side?

Not as I am aware. I’m using the built in ts for both createdAt and updatedAt.