I'm using Azure Node.js SDK and am having trouble getting this query to work:
var ts1 = azure.createTableService(config.storageAccount, config.storageAccessKey, config.tableHost);
var query = azure.TableQuery
.select()
.from('users')
.where('PartitionKey eq ?', '0')
.and('FriendsSeeVideo eq ?', 'true')
.and('Status eq ?', 'Active');
var firstTimeThrough = true;
for (f in friends){
if (firstTimeThrough){
query.and('UserID eq ?', friends[f].id);
firstTimeThrough = false;
}
else query.or('UserID eq ?', friends[f].id);
}
When I write the query to the screen I get an Azure Table Query that looks like this:
query = {"_fields":[],"_from":"users","_where":["PartitionKey eq '0'"," and FriendsSeeVideo eq 'true'"," and Status eq 'Active'"," and UserID eq '763424639'"," or UserID eq '1385552681'"," or UserID eq '100001386550915'"," or UserID eq '100001869159941'"],"_top":null,"_partitionKey":null,"_nextPartitionKey":null,"_rowKey":null,"_nextRowKey":null}
but it's not returning the result I expect. There is 1 user that satisifies the conditions in table storage and the result should be returning the user with userID 763424639 but it's not?
Basically I am passing in a friend set and asking table storage if these people exist in the users table and to return them if they have enabled the FriendsSeeVideo setting.
Can anyone see what I am doing wrong?
Just a guess, but perhaps you want to be using a boolean true rather than the string 'true'? It's hard to tell from this what's wrong... maybe you can show us the actual entity that you expect to be returned.
I was calling the field [FriendsSeeVideo] by the wrong name it should have been [FriendsSeeVideoView].
I think I'll leave this question on SO because my example code can help somebody wondering how to compare and retrieve sets from table storage.