$$SEARCH_META Undefined with GRAPHQL Custom Resolvers

Hi,

I got problem when i want to use $$SEARCH_META for count behind graphql of Realm.

"FunctionError: Location17276 Invalid $project :: caused by :: Use of undefined variable: SEARCH_META"

When i simply use my aggregation like this example, count works well, but not behind graphql custom resolver

  {
    "$search": {
      "near": {
        "path": "released",
        "origin": ISODate("2011-09-01T00:00:00.000+00:00"),
        "pivot": 7776000000
      },
        "count": {
          "type": "total"
        }
      }
    },
    {
      $project: {
        "meta": "$$SEARCH_META",
        "title": 1,
        "released": 1
      }
    },
    {
      "$limit": 2
    }
  ])

Any idea ? Thanks

1 Like