Hi!
I used mongo atlas before and thought this time I would have it setup and running in 5 seconds bu spent a long time trying to get things work:

Here is the setup:

{
  "mappings": {
    "dynamic": false,
    "fields": {
      "_id": {
        "type": "objectId"
      },
      "list": {
        "type": "objectId"
      },
      "team": {
        "type": "objectId"
      },
      "listTaskDBSearch": {
        "dynamic": false,
        "type": "document",
        "fields": {
          "carBrands": {
            "type": "string"
          },
          "carModels": {
            "type": "string"
          },
          "companyName": {
            "type": "string"
          },
          "revenue": {
            "type": "number"
          },
        }
      }
    }
  }
}

In the Search Tester it can’t even find:

[
  {
    "$search": {
      "index": "listTask",
      "compound": {
        "must": [{ "equals": { "value": "67330e6968f83154de493461", "path": "_id" } }],
      }
    }
  }
]

Here is the document:

{"_id":{"$oid":"67330e6968f83154de493461"},"identifier":"-905644061","company":{"$oid":"6732e27868f83154de292029"},"list":{"$oid":"67330e69b1232f8b224a0f21"},"team":{"$oid":"66e5b32a2d6349b37ee8c051"},"__v":{"$numberInt":"0"},"createdAt":{"$date":{"$numberLong":"1731399273309"}},"lead":{"_id":{"$oid":"67330e69b1232f8b224a0f24"},"person":{"_id":"-905644061","name":{"first":"Martin","last":"Cronsioe","full":"Martin Cronsioe","_id":{"$oid":"6732ecd1fb9f93f503176643"}},"phones":[{"label":"Martin Cronsioe","callTo":"010 614 33 28","foundAtUrl":"https://vinge.se/vara-tjanster/verksamhetsomraden/private-funds/","_id":{"$oid":"6732eccdfb9f93f503176500"}}],"addresses":[],"emails":[{"email":"martin.cronsioe@vinge.se","foundAtUrl":"https://vinge.se/vara-tjanster/verksamhetsomraden/private-funds/","label":"Martin Cronsioe","_id":{"$oid":"6732eccdfb9f93f503176501"}}],"links":[],"positions":[],"companies":[{"name":"Advokatfirman Vinge Göteborg Aktiebolag","orgNumber":"5566886551","legalname":"Advokatfirman Vinge Göteborg Aktiebolag","currency":"sek"}],"company":{"$oid":"6732e27868f83154de292029"},"isDecisionMaker":false,"createdAt":{"$date":{"$numberLong":"1731399273309"}},"updatedAt":{"$date":{"$numberLong":"1731399273309"}}},"phones":[{"label":"Martin Cronsioe","callTo":"010 614 33 28","foundAtUrl":"https://vinge.se/vara-tjanster/verksamhetsomraden/private-funds/","_id":{"$oid":"6732eccdfb9f93f503176500"}}],"emails":[{"email":"martin.cronsioe@vinge.se","foundAtUrl":"https://vinge.se/vara-tjanster/verksamhetsomraden/private-funds/","label":"Martin Cronsioe","_id":{"$oid":"6732eccdfb9f93f503176501"}}],"links":[],"user":{"$oid":"66e5b32a2d6349b37ee8c04f"},"team":{"$oid":"66e5b32a2d6349b37ee8c051"},"company":{"$oid":"6732e27868f83154de292029"}},"listTaskDBSearch":{"companyName":"Advokatfirman Vinge Göteborg Aktiebolag","industries":["Advokatbyråer"],"naceCodes":["6 Advokatbyråverksamhet"],"orgType":"ab","orgNumber":"5566886551","revenue":{"$numberInt":"0"},"profit":{"$numberInt":"55050000"},"employeeCount":{"$numberInt":"57"},"employeeNames":["Martin Cronsioe"],"emails":["martin.cronsioe@vinge.se"],"phones":["010 614 33 28"],"links":["https://vinge.se","https://allabolag.se//foretag/advokatfirman-vinge-g%C3%B6teborg-aktiebolag/g%C3%B6teborg/-/5566886551","https://proff.se/foretag/advokatfirman-vinge-g%C3%B6teborg-aktiebolag/g%C3%B6teborg/-/5566886551","https://linkedin.com/company/vinge","https://facebook.com/vinge.se","https://instagram.com/vinge_life"],"roles":["Ordförande","Verkställande direktör","Ledamot","Suppleant","Suppleant","Huvudansvarig revisor","Giving brands direction and personality"],"_id":{"$oid":"67330e69b1232f8b224a0f32"}},"listType":"employee","status":"finished","updatedAt":{"$date":{"$numberLong":"1731399273309"}},"user":{"$oid":"66e5b32a2d6349b37ee8c04f"}}

Howewer if I just use the standard setup:

{
  "mappings": {
    "dynamic": true
  }
}

Things start to appear.
Yes I double checked that the index name matches.

Thanks for your help

The issue is that the “value” in your equals is a string, not an ObjectID. Here’s a Search Playground that demonstrates it working as expected.

(apologies for the previous replies - I was not properly creating an ObjectID in my attempts at duplicating it at first; I deleted those flawed comments)

To put the code in-line here, this should work for you:

[
  {
    $search: {
      equals: {
        value: ObjectId("67330e6968f83154de493461"),
        path: "_id"
      }
    }
  }
]

Thanks for your replies. I would like the equal _id part to work, not that I need that but I need at least team objectId to work. The text search does not work either like listTaskDBSearch. companyName . With dynamic true I get the document by writing “vinge” for instance

there seem to be some bug which me and others are encountering. Things that did not work the other day works now.

this document is not found by this query:

{
  "_id": { "$oid": "67330f1568f83154de49a327" },
  "team": { "$oid": "66e5b32a2d6349b37ee8c051" },
  "listTaskDBSearch": {
    "orgNumber": "5566886551"
  },
  "listType": "company"
}
[
  {
    "$search": {
      "index": "listTask",
      "compound": {
        "must": [
          { "equals": { "value": ObjectId("66e5b32a2d6349b37ee8c051"), "path": "team" } },
          { "equals": { "value": "company", "path": "listType" } }
        ],
        "filter": [],
        "should": [
          {
            "text": {
              "query": "5566886551",
              "path": [
                "listTaskDBSearch.companyName",
                "listTaskDBSearch.orgNumber"
              ]
            }
          }
        ]
      }
    }
  }
]

It has to do with the { “equals”: { “value”: “company”, “path”: “listType” } } but I do have it in

{
  "mappings": {
    "dynamic": false,
    "fields": {
      "_id": {
        "type": "objectId"
      },
      "team": {
        "type": "objectId"
      },
      "listType": {
        "type": "string"
      },
      "listTaskDBSearch": {
        "dynamic": false,
        "type": "document",
        "fields": {
          "orgNumber": {
            "type": "string"
          }
        }
      }
    }
  }
}

It starts to drive me a bit nuts. Just removing listType makes it work.

This Playground configuration matched your document and query:

https://search-playground.mongodb.com/tools/code-sandbox/snapshots/678bcae76ce5459b887eca0f

Here’s the configuration from it:

{
  "mappings": {
    "dynamic": true,
    "fields": {
      "_id": [
        {
          "type": "objectId"
        }
      ],
      "team": [
        {
          "type": "objectId"
        }
      ],
      "listType": [
        {
          "type": "token"
        }
      ]
    }
  }
}