FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date.

Fauna accounts created after August 21, 2024 must use FQL v10. These accounts will not be able to run FQL v4 queries or access the v4 Dashboard.

For more details, see the v4 EOL announcement and migration guide. Contact support@fauna.com with any questions.

Known issues

This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics.

This page describes issues where FQL functions do not behave as intended in various situations. These are all issues that we intend to fix, but the solutions may take some time.

Dates and Times

  • We claim support for ISO 8601 time and date formats, but the library that we use does not, in fact, support all variations of ISO 8601.

Sets

  • When you attempt to Paginate a set composed with one (or more) of the set functions, such as Intersection, an estimator uses the page size to guess how many items to fetch from the set for manipulation. When the page size is too small to reach far enough into the set, the result may contain far fewer entries than expected. Increasing the page size can often improve the results.

  • The Join function does not behave well with reversed indexes. You might try using Union instead.

    For example, the following query uses the Join function to combine the result of the documents in the products_by_store index with the reverse-sorted results from the inventory_by_product index:

    Paginate(
      Join(
        Match(
          Index('products_by_store'),
          Ref(Collection('stores'), '301')
        ),
        Lambda(
          ['name', 'description', 'price'],
          Match(Index('inventory_by_product'), Var('name'))
        )
      ),
      { size: 2 }
    )

    This returns 2 results, including an after cursor that points to the entry that would start the next page of results:

    {
      after: [
        100,
        'Organic, 1 bunch',
        Ref(Collection("products"), "208"),
        Ref(Collection("products"), "208")
      ],
      data: [
        [
          1000,
          'Conventional Hass, 4ct bag',
          Ref(Collection("products"), "204")
        ],
        [ 1000, 'Conventional, 1 ct', Ref(Collection("products"), "205") ]
      ]
    }

    However, when the next page of results are fetched using the after cursor, the results are reset to the first page:

    Paginate(
      Join(
        Match(
          Index('products_by_store'),
          Ref(Collection('stores'), '301'),
        ),
        Lambda(
          ['name', 'description', 'price'],
          Match(Index('inventory_by_product'), Var('name'))
        )
      ),
      {
        size: 2,
        after: [
          100,
          'Organic, 1 bunch',
          Ref(Collection("products"), "208"),
          Ref(Collection("products"), "208")
        ]
      }
    )
    {
      before: [
        100,
        'Organic, 1 bunch',
        Ref(Collection("products"), "208"),
        Ref(Collection("products"), "208")
      ],
      after: [
        100,
        'Organic, 1 bunch',
        Ref(Collection("products"), "208"),
        Ref(Collection("products"), "208")
      ],
      data: [
        [
          1000,
          'Conventional Hass, 4ct bag',
          Ref(Collection("products"), "204")
        ],
        [ 1000, 'Conventional, 1 ct', Ref(Collection("products"), "205") ]
      ]
    }

    To work around the issue, the same query can be rewritten using the Union function:

    Paginate(
      Let(
        {
          product_set: Match(
            Index("products_by_store"),
            Ref(Collection("stores"), "301")
          ),
          products_page: Select(
            "data",
            Paginate(Var("product_set"), { size: 100000 })
          ),
          leaf_sets: Map(
            Var("products_page"),
            Lambda(
              ["name", "description", "price"],
              Match(Index("inventory_by_product"), Var("name"))
            )
          )
        },
        Union(Var("leaf_sets"))
      ),
      { size: 2 }
    )
    {
      after: [
        100,
        'Organic, 1 bunch',
        Ref(Collection("products"), "208"),
        Ref(Collection("products"), "208")
      ],
      data: [
        [
          1000,
          'Conventional Hass, 4ct bag',
          Ref(Collection("products"), "204")
        ],
        [ 1000, 'Conventional, 1 ct', Ref(Collection("products"), "205") ]
      ]
    }

    With this approach, paginating over the next page(s) of results works as expected:

    Paginate(
      Let(
        {
          product_set: Match(
            Index("products_by_store"),
            Ref(Collection("stores"), "301")
          ),
          products_page: Select(
            "data",
            Paginate(Var("product_set"), { size: 100000 })
          ),
          leaf_sets: Map(
            Var("products_page"),
            Lambda(
              ["name", "description", "price"],
              Match(Index("inventory_by_product"), Var("name"))
            )
          )
        },
        Union(Var("leaf_sets"))
      ),
      {
        size: 2,
        after: [
          100,
          'Organic, 1 bunch',
          Ref(Collection("products"), "208"),
          Ref(Collection("products"), "208")
        ]
      }
    )
    {
      before: [
        100,
        'Organic, 1 bunch',
        Ref(Collection("products"), "208"),
        Ref(Collection("products"), "208")
      ],
      after: [
        30,
        'Conventional, 16 oz bag',
        Ref(Collection("products"), "207"),
        Ref(Collection("products"), "207")
      ],
      data: [
        [ 100, 'Organic, 1 bunch', Ref(Collection("products"), "208") ],
        [ 50, 'Organic, 16 oz bag', Ref(Collection("products"), "206") ]
      ]
    }
    The workaround using Union consumes more read-ops than the query with Join. See Per query metrics to understand how a query’s resource usage is reported.

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!