Search index and query with C# Guid field

Hi

I have a collection named Projects that contains an embedded document Customer, with an Id field that stores a Guid value from .NET (NUUID)

I’ve built the search index this way:

{
  "mappings": {
    "dynamic": false,
    "fields": {
      "Details": {
        "fields": {
          "Customer": {
            "fields": {
              "Id": {
                "type": "objectId"
              }
            },
            "type": "document"
          },
        },
        "type": "document"
      },
  }
}

I’d like to know if this is the very best way to define the index in this particular case and, if so, how can I perform the query in the $search stage.

I’ve tried the code below, in C#, but it didn’t work:

new BsonDocument("equals",
                    new BsonDocument { new BsonElement("path", "Details.Customer.Id"),
                                       new BsonElement("value", new BsonBinaryData(customerId, GuidRepresentation.CSharpLegacy)) });

Ele produziu a seguinte pipeline :

{ "equals" : { "path" : "Details.Customer.Id", "value" : CSUUID("d9e9e08b-11f7-4c38-ab42-85bff1e022d4") } }

E o seguinte erro:
“compound.filter[1].equals.value” must be a boolean or objectId"

How to implement this?

Thanks for now

Hello @Elle_Shwer

I’m mentioning you in this post, because I’ve found another one that you replied that UUID fields are not currently supported (Atlas Search - Compound Index UUID + Text).
I’d like to know if there is any expectation of support for this field type and how I could follow the ongoing process.

Thanks for now
I will be waiting anxiously for a reply

Hi Jefferson, you can track our plans in this feedback item . Voting on it helps us prioritize it and will keep you posted on when we do it.

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.