Siva SM
Siva SM

Reputation: 37

getmetadata for a selection of blobs in Azure Blob Storage NodeJs

I am developing a azure function which connects to azure storage to get a selective list of blobs metadata based on a particular metadata on those blobs. For example, On all the blobs in the storage,there will be a metadata called type which stores values like news,change notice, faqs etc. We might have 50 blobs which are news, another 50 which are change notice and another 50 which are faqs.

Now from function, i request for all the blobs with type news, the function should return metadata of all the blobs with news in json like the sample below:

value: [
{ object : abc.xml,
  data created : Mar 20,2018,
  type : news,
  creator name : john
}
{
   object : xyz.xml,
   data created: Mar 13,2018,
   type : news,
   creator name : Siva
}
{
   object : dce.xml,
   data created: Mar 20,2018,
   type : news,
   creator name : John
}

and then i have to sort the data based on metadata. I see option to getmetadata and getproperties for single blob but i dont see any option to get something i just mentioned above through storage sdk. Is it possible to achieve this with Blob Storage metadata and Is there any sdk methods available to achieve it?

[Edit] The filter type to get the blobs will not change.

Upvotes: 0

Views: 681

Answers (1)

Gaurav Mantri
Gaurav Mantri

Reputation: 136136

Is it possible to achieve this with Blob Storage metadata and Is there any sdk methods available to achieve it?

What you're trying to accomplish is unfortunately not supported in Azure Blob Storage. You can't query blobs on metadata (or for that matter any other properties like last modified date, content type etc.) and perform server-side filtering.

What you would need to do is fetch the list of blobs and do the filtering on the client side (in function code in your case).

Other alternative would be to make use of other services like Cosmos DB or Azure Table Storage. With Cosmos DB and Azure Table Storage, you can store this metadata there along with the blob URL and do the search in those store to get the desired results.

Upvotes: 1

Related Questions