Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equals match not working for subdocument in an array #1777

Open
maheshrajamani opened this issue Dec 4, 2024 · 1 comment
Open

Equals match not working for subdocument in an array #1777

maheshrajamani opened this issue Dec 4, 2024 · 1 comment
Assignees
Labels
Bug Something isn't working Feature - Collections Issue impacts users of Collections

Comments

@maheshrajamani
Copy link
Contributor

If we have a data as below filter condition on entiry.identities.iAttributes works with $all but $eq not returning

{
                "entity": {
                    "entityType": "customer",
                    "status": "active",
                    "identities": 
                        {
                            "iRole": "individual",
                            "iAppCode": "CIS",
                            "iAttributes": [
                                {
                                    "aKey": "companyId",
                                    "aValue": "96"
                                },
                                {
                                    "aKey": "customerId",
                                    "aValue": "CHAMIL"
                                },
                                {
                                    "aKey": "customerTie",
                                    "aValue": "1"
                                },
                                {
                                    "aKey": "customerNumber",
                                    "aValue": "16562798"
                                }
                            ],
                            "identityKey": "customer-001",
                            "iStatus": "active",
                            "metadata": {
                                "createdDate": "2024-08-27T19:16:59Z",
                                "lastModifiedDate": "2024-08-27T19:16:59Z",
                                "createdBy": "CISBatchApp",
                                "lastModifiedBy": "CISBatchApp"
                            }
                        }
                    ,
                    "entityRelationshipLinks": [],
                    "identityRelationshipLinks": [],
                    "metadata": {
                        "createdDate": "2024-08-27T19:16:59Z",
                        "lastModifiedDate": "2024-08-27T19:16:59Z",
                        "createdBy": "CISBatchApp",
                        "lastModifiedBy": "CISBatchApp"
                    }
                }
            }

Working $all condition

{
    "find": {
        "filter": {
            "entity.identities.iAppCode": "CIS",
            "entity.identities.iAttributes": {
                "$all": [
                    {
                        "aKey": "companyId",
                        "aValue": "96"
                    }
                ]
            }
        }
    }
}

Not working equals:

{
    "find": {
        "filter": {
            "entity.identities.iAppCode": "CIS",
            "entity.identities.iAttributes": {
                "aKey": "companyId",
                "aValue": "96"
            }
        }
    }
}
@maheshrajamani maheshrajamani added Bug Something isn't working Feature - Collections Issue impacts users of Collections labels Dec 4, 2024
@maheshrajamani
Copy link
Contributor Author

The issue here is data-api uses query_text_values column for sub-document equals condition. If the data is array of subdocuments, the code considers the query as a sub document match and not an array element match.

@maheshrajamani maheshrajamani changed the title Equals match not working for subdocument array Equals match not working for subdocument in an array Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Feature - Collections Issue impacts users of Collections
Projects
None yet
Development

No branches or pull requests

1 participant