本文介绍了nodejs根据时间戳查询azure存储表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过使用查询成功地使用分区键查询了表

I successfully query the table with Partition Key by using the query:

var query= new azure.TableQuery().where('PartitionKey ne ?','test');

但是我尝试查询时间戳,但是失败了.

But I tried to query with the timestamp but failed.

var query=new azure.TableQuery().where('Timestamp ge ?', azure.TableUtilities.entityGenerator.DateTime(new Date(Date.UTC(2014,11,11,00,00,00))));

我认为DateTime是Nodejs的SDK.但是我不确定为什么这是不正确的.错误是查询错误.有人可以帮我吗?谢谢.

I think the DateTime is the SDK for Nodejs. But I'm not sure why it's not correct. The error is the query if wrong. Can anyone help me with that? Thanks.

推荐答案

有几种方法可以在Azure存储Node.js库中创建表查询.如果您查看 TableQuery您会在 Azure Storage Node.js GitHub 存储库中找到类有关如何在.where()方法文档中构造查询的几个示例.进行查询的两种方法如下:

There are several ways to create table queries in the Azure Storage Node.js library. If you take a look at the TableQuery class in the Azure Storage Node.js GitHub repository you'll find several examples on how to construct queries in the .where() method docs. Two ways of doing your query are below:

  • var tableQuery = new TableQuery().where(TableQuery.dateFilter('Timestamp', QueryComparisons.GREATER_THAN_OR_EQUAL, dateVal));
  • var tableQuery = new TableQuery().where('Timestamp >= ?date?’, dateVal);
  • var tableQuery = new TableQuery().where(TableQuery.dateFilter('Timestamp', QueryComparisons.GREATER_THAN_OR_EQUAL, dateVal));
  • var tableQuery = new TableQuery().where('Timestamp >= ?date?’, dateVal);

这篇关于nodejs根据时间戳查询azure存储表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 11:56