0

I'm using azure document db in my ASP.net MVC application.And currently I'm having 2 collections in it which are Employees and Tasks. Currently everything is working fine with document db operations.

But I couldn't find a way to upload multiple images(not multiple images at once ) against a document. eg: assume I need to store 2 employee pictures against a single employee document.

I've read about the azure blob storage and think I can use it for the file uploads.But the thing that I can unable to clarify is how to keep the references of the uploaded files in each employee documents.

Is there any way to do that?

tarzanbappa
  • 4,930
  • 22
  • 75
  • 117

1 Answers1

5

I've read about the azure blob storage and think I can use it for the file uploads.But the thing that I can unable to clarify is how to keep the references of the uploaded files in each employee documents.

Each blob in blob storage is accessible via a URL. What you could do is save these URLs along with the document. For example, your Employee JSON could look like:

Employee = {
  'Id': '0001',
  'Name': 'Some Name',
  'Pictures': [
    'https://account.blob.core.windows.net/container/image1.png',
    'https://account.blob.core.windows.net/container/image2.png'
  ]
}

Other thing you could do is look at Attachments in DocumentDB.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241