Value which I am storing is not returned when I queried the record back

Mahesh Raja Mahalingam 81 Reputation points
2025-12-17T04:16:26.03+00:00

Hi Team,

I my cosmos (NoSql) database i am storing a record with a value (tripID: 18031765881344672) , But when I query the same record it gave me the record with different tripID value (18031765881344670) . Somehow the cosmos is rounding off I believe. Has anyone encountered such issue. Its Scarry !!! How Can I fix this ? or What is the alternative solution

User's image

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. VRISHABHANATH PATIL 4,825 Reputation points Microsoft External Staff Moderator
    2025-12-17T04:29:06.61+00:00

    Hi @Mahesh Raja Mahalingam

    It looks like you’re having issues retrieving the correct tripID from your Azure Cosmos DB. This can be quite concerning, especially if you believe that it might be rounding off values. Let’s see if we can narrow down what’s happening.

    Potential Reasons and Solutions:

    Data Type and Precision: Ensure that the data type for tripID can handle large numbers. If you're storing tripID as an integer, it might lead to rounding issues. Consider storing it as a string to preserve the value as is.

    Query and Indexing: Double-check your query syntax. If you're using indexes, ensure that the indexing policy you’ve set covers the properties you’re filtering on, as unindexed properties may result in unpredictable behavior.

    Schema Constraints: If you are using Azure Synapse Link or similar features, know that there are schema constraints, like property limits (1000 properties) or depth limits (127 nested properties) that might cause properties to replicate as NULLs or might miss completely.

    Synchronization Delay: If you recently added or modified the record, remember that there might be a delay (usually a few minutes) in syncing between the transactional and analytical stores, leading to discrepancies.

    Steps to Troubleshoot:

    • Check Data Type: Confirm that tripID is stored as a string in your Cosmos DB.
    • Review Your Query: Make sure your query correctly references tripID exactly as it's stored.
    • Examine Indexing Policy: Look at the indexing policy to check if tripID is included.
    • Test Synchronization Delay: Wait a few minutes and query again to see if the correct value appears.

    Follow-Up Questions:

    1. What data type are you using to store the tripID?
    2. Can you share the exact query you are using to retrieve the record?
    3. Have you made any recent changes to your Cosmos DB settings or your application code?
    4. Are you using any data synchronization or analytical services like Azure Synapse Link?
    5. How frequently do you encounter this issue, and does it happen with other records as well?

    I hope this information helps you identify the issue! If you need further assistance, feel free to provide additional details.

    References:

    Let me know if you have other questions!

    1 person found this answer helpful.

Your answer

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