Double data type is returned as int32 in Azure cosmos table api using @azure/data-tables sdk

122 Views Asked by At

I am trying to list the entities in an Azure Cosmos table API table. I have an entity whose property is of data type double when it is created using the node sdk @azure/data-tables. But when I try to list it using the same sdk, the data type of that property is returned as int32 instead of double. But when I view the same entity in Azure portal, the data type is double. Please let me know if I am missing something. Please find the code below.

const account = "<accountName>";
const accountKey = "<key>";
const tableName = "<tableName>";

const credential = new AzureNamedKeyCredential(account, accountKey);
const client = new TableClient(
    `https://${account}.table.cosmos.azure.com:443/`, tableName, credential);


async function list() {
    let entitiesIter = client.listEntities({
        disableTypeConversion: true
    }).byPage({ maxPageSize: 300 });
    for await (let e of entitiesIter) {
        console.log(e);
    }
}


async function insertEntity() {
    const tesetEntity = {
        RowKey: "rowKey",
        partitionKey: "partitionKey",
        double: { value: 788123456789, type: 'Double' }
    };
    try {
        await client.createEntity(tesetEntity);
    }
    catch (e) {
        
    }
}

//list();
insertEntity();
0

There are 0 best solutions below