Unrecognized pipeline stage name: ‘$searchMeta’

Hello, I’m trying to use $searchMeta in React using Realm, and it produces this error:

Error retrieving facets: Error: Request failed (POST https://us-west-2.aws.realm.mongodb.com/api/client/v2.0/app/xxxxx/functions/call): Location40324 Unrecognized pipeline stage name: ‘$searchMeta’ (status 500) at MongoDBRealmError.fromRequestAndResponse.  

However, I do the same for other $match, $search, and other stages and it works properly.

This is the code:

    const collection = await connectToMongoDB(connetionData);
    const pipeline = [];
      $searchMeta: {
        index: “hc-appointments”,
        facet: {
          facets: {
            stringFacet: {
              type: “string”,
              path: patient.display
    const facets = await collection.aggregate(pipeline);

Does anyone know what am I doing wrong?
Thanks a lot

Hey @Paco_Mateu,

Welcome to the MongoDB Community!

In the current implementation, the $searchMeta aggregation pipeline stage is only available for collections hosted on MongoDB Atlas cluster tiers running MongoDB version 4.4.9 or later. To learn more, please refer to the Atlas Search documentation.

Based on the details, it seems that you are trying to implement the $searchMeta aggregation pipeline in your React codebase while using MongoDB Realm as a mobile database.

May I ask what you are trying to achieve with this implementation? Could you please provide more context about your use case? This will help us assist you more effectively.

Look forward to hearing from you.