Table 实体未保留

Table Entity not preseved

对于插入到Azure Table存储中的数据,如何确保通过查询返回相同的数据类型?例如使用 Azure Storage SDK for Node.js,如果您执行 insertEntity() 插入以下数据:

{
  PartitionKey: { _: 'the-primary-key', '$': 'Edm.String' },
  RowKey: { _: 'the-row-key', '$': 'Edm.String' },
  jsNum1: { _: 1, '$': 'Edm.Double' },
  jsNum2: { _: 1.1, '$': 'Edm.Double' }
}

并使用 queryEntities() 检索相同的数据,您将得到:

{
  PartitionKey: { '$': 'Edm.String', _: 'the-primary-key' },
  RowKey: { '$': 'Edm.String', _: 'the-row-key' },
  Timestamp: { '$': 'Edm.DateTime', _: 2016-07-20T09:47:24.428Z },
  jsNum1: { _: '1.0' },
  jsNum2: { _: 1.1 },
  '.metadata': { etag: 'W/"datetime\'2016-07-20T09%3A47%3A24.4285502Z\'"' }
}

虽然 jsNum1jsNum2 被插入为 Edm.Double 查询 returns:

既然插入时指定了Edm.Double,那么jsNum1._jsNum2._不应该是同一种类型吗?

您使用的是哪个版本的 azure-storage 模块。此问题已在最新版本中修复。请查看 azure-storage-node 存储库的 GitHub 问题。 https://github.com/Azure/azure-storage-node/issues/40