Can't create UDF with valid FQL syntax

I’m trying to create a UDF (code below) and I’m getting a rather not-so-useful error message: “No form/function found, or invalid argument keys: { create, params }.”

The code below in the UDF runs just fine in the shell:

Query(
  Create(
    Collection("Session"),
    { data: { id: NewId(), start_ts: Now(), is_active: false } }
  )
)

Any ideas?

Hi @aloukissas and welcome.

Query() function only accept Lambda as argument. You can check our documentation here.

Should work this way:

Query(
  Lambda('x',
    Create(
      Collection("Session"),
      { data: { id: NewId(), start_ts: Now(), is_active: false } }
    )
  )
)

Luigi

Thanks! Definitely the error messages in the create UDF page need much improvement. Very cryptic at this point.