CosmosDB SQL where clause with numerical or boolean values giving weird results

Kholofelo 66 Reputation points
2020-10-29T02:41:21.217+00:00

Hi,

I have a weird issue with a very simple CosmosBD query. See the below query.

Basically, I have a simple query as follows:

select * from c where c.redeemed=1  

This query for some reason returns results with items with redeemed as 0.

Any help would be appreciated.

35886-image.png

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,609 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Kholofelo 66 Reputation points
    2020-10-29T09:42:28.093+00:00

    Hi @AnuragSharma-MSFT

    The issue suddenly disappeared (which is extremely worrying) so I switched back my data to using booleans and now I have the same issue again.

    See below an example document:

        {  
                "dateCreated": "2020-10-28T23:20:45.1422932+00:00",  
                "dateRedeemed": "0001-01-01T00:00:00+00:00",  
                "userRedeemed": null,  
                "pointsGroup": null,  
                "redeemed": false,  
                "data": {  
                    "voucherCode": "T2XYH-8666A-33F3P-XXXXX",  
                    "provider": {  
                        "name": "some-name,  
                        "id": "b654c045-5fdc-42d1-b178-478fb708814a",  
                        "instructionsLink": "https://example.com"  
                    }  
                },  
                "partitionKey": "voucher",  
                "type": "loyalty_voucher"  
            }  
    

    This gives the same weird issue:
    36027-image.png

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.