如何使用 Fauxton/C 中的 Selector 函数从 couchDB 的嵌套对象中获取数据#

How to get data from nested objects of couchDB using Selector function in Fauxton/C#

我正在为我的应用程序开发 Angular 12 和 web API 核心和 couch Db。 我有一堆数据坐在名为“PersonnelConfigurations”的沙发数据库中,我需要根据 personnelId 获取数据,但数据库是用嵌套对象构建的。我基本上是在尝试从我的 C# 代码调用沙发,我可以在其中使用选择器作为我的 Async 的查询参数并获取所需的详细信息。

I am looking to get data from couch DB from a Db whose docs look like below
**Couch Db Database - Document**

{
  "_id": "PersonnelConfiguration:00f68fc2-7f35-4053-9166-32ff9e742d61",
  "_rev": "1-2656093aead64a17e30371dfb9b6e4ty",
  "partitions": [
    {
      "personnel": [
        {
          "personnelId": 11440,
          "personnelName": "Test, Simulator",
          "personnelType": "None",
          "personnelThumbnail": "/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyM"
        }
      ],
      "partitionId": 1,
      "partitionName": "Default"
    }
  ],
  "siteId": "ef6ac7ab-2812-422b-b81a-e86927ebtr54d",
  "siteName": "Test Site"
}


I tried all the below selector but it is not fetching any details. 

Couch Db 选择器尝试的查询:

{
   "selector": {
      "partitions": {
         "personnel": {
            "$elemMatch": {
               "personnelId": 11440
            }
         }
      }
   }
}

谁能帮我解决这个问题?我基本上是想根据嵌套对象的特定 id 获取个人详细信息,使用我的 C# 代码,当然,我可以在 C# 中使用我的选择器查询。所以需要查询根据 personnelId.

获取 personnelNamepersonnelThumbnailPersonnelType 等详细信息
{
   "selector": {
      "partitions": {
         "$elemMatch": {
            "personnel": {
               "$elemMatch": {
                  "personnelId": 1140
               }
            }
         }
      }
   }
}