There are a lot of examples circulating around the internet about how you can use CompareTo with Azure Table Storage to basically do some substring searching from C# , but I can't find anything showing how to do it in NodeJS and all the syntaxes I've tried to put together just throw back various syntax or invalid query storage exceptions.
Can anyone tell me how to do the equivalent of the C# example on this website, but from NodeJS? https://lifeportal.azurewebsites.net/azure-table-storage-searching-entities-using-query-like-substring-or-left/
string projectIdString = projectId.ToString().ToLower(); // projectId - Guid
string startQuery = projectIdString + "_"; // Our separate symbol
string endQuery = projectIdString + "`"; // Next symbol in ASCII table after "_"
Expression<Func<DynamicTableEntity, bool>> filters = (e.RowKey.CompareTo(startQuery) >= 0 && e.RowKey.CompareTo(endQuery) < 0);
CloudTable table = _storageContext.Table(Tables.Users);
bool result = await DeleteAllEntitiesInBatches(table, filters);
return result;
What seems like the most obvious of:
const TABLE_NAME = 'MYTABLE';
var azure = require('azure-storage');
var tableService = azure.createTableService();
var query = new azure.TableQuery()
.where('PartitionKey eq ?', 'MYKEY').and('RowKey.compareTo(\'1-\') ge ?', 0);
tableService.queryEntities(TABLE_NAME, query, null, function(error, result, response) {
if (!error) {
// result.entries contains entities matching the query
}
});
Results in:
"An unknown function with name 'RowKey.compareTo' was found. This may also be a key lookup on a navigation property, which is not allowed."