简体   繁体   English

RESTHeart和Retrofit POST嵌入文档以及二进制数据

[英]RESTHeart and Retrofit POST embedded document with binary data

I am looking to POST embedded document in my collection in MongoDB using RESTHeart by means of Retrofit. 我希望通过Retrofit使用RESTHeart在MongoDB中的我的收藏集中发布嵌入式文档。 This is that this document should be with binary data. 这是该文档应带有二进制数据。 If to put json representation of this document it shoule be like this 如果要放置此文件的json表示,应该这样

{ 
"id":"5b50aa602f925f13fc3a3da2", 
    "documents":[ 
          {"id":"1", "name":"firstDocument" , "content":BINARY_DATA1}
          {"id":"2", "name":"secondDocument" , "content":BINARY_DATA2}
     ]
}

Can someone help on this ? 有人可以帮忙吗?

I've checked documentation and currently did not find out how to resolve this issue. 我已经检查了文档,目前还没有找到如何解决此问题的方法。

Just post the json to the collection with binary data encoded in base 64. 只需将json发送到以base 64编码的二进制数据中即可。

Hiwever,for binary data you better use files buckets. 但是,对于二进制数据,最好使用文件存储桶。 But in this case you cannot have two files in one document. 但是在这种情况下,一个文档中不能有两个文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM