簡體   English   中英

如何將圖像文件存儲在 Azure Cosmos DB 中?

[英]How to store image files in Azure Cosmos DB?

我正在嘗試將圖像上傳到 azure cosmos DB,但找不到任何文檔。

我們正在使用新版本的 cosmos DB 庫:

implementation 'com.azure:azure-cosmos:3.1.0'

我從 com.microsoft.azure.cosmosdb.rx package 找到了 AsyncDocumentClient

public Observable<>> createAttachment(String documentLink, Attachment attachment, RequestOptions options)

public Observable<>> createAttachment(String documentLink, InputStream mediaStream, MediaOptions options, RequestOptions requestOptions)


but this library( java Async SDK v2 ) has been deprecated and replaced with the new SDK( Java Sdk v4 ). 我在新的 SDK 中找不到任何有關托管附件的信息。 我們現在有哪些選項可以上傳文件?

PS。 我知道我們應該使用 azure 中的 blob 存儲,但我們現在沒有

您真的應該轉移到 blob 存儲,附件已過時,如文檔中所述

附件是一項遺留功能。 如果您已經在使用此功能,他們的支持范圍可提供持續的功能。

我們建議您不要使用附件,而是使用 Azure Blob 存儲作為專門構建的 Blob 存儲服務來存儲 Blob 數據。 您可以繼續將與 blob 相關的元數據以及參考 URI 鏈接存儲在 Azure Cosmos DB 中作為項目屬性。 將此數據存儲在 Azure Cosmos DB 中提供了查詢元數據和指向存儲在 Azure Blob 存儲中的 blob 的鏈接的能力。

這就是為什么您不會在較新的 SDK 中找到它的原因。 因此,要么堅持使用較舊的庫(不推薦),要么轉向新方法。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM