SoftInstigate / restheart

Rapid API Development with MongoDB
https://restheart.org
GNU Affero General Public License v3.0
807 stars 171 forks source link

Content of "properties" field specified for Files is returned in "metadata" field in RH3 #207

Closed grossmueller-espirit closed 7 years ago

grossmueller-espirit commented 7 years ago

Hi there,

yet another question about changes in RH3. It seems that information added to a file via the "properties" field is now grouped inside a new property called "metadata". So the response format is different (=more structured than in RH2). Is there any documentation on this? Like, is "metadata" always present (but possible empty) or is it optional? What about contentType - that seems to be added automatically. Are there any similar changes to the structure for documents?

Thanks again for your valuable support, Tanja

ujibang commented 7 years ago

Hi @grossmueller-espirit

this is how mongodb represents the file data, have a look at https://docs.mongodb.com/manual/core/gridfs/#the-files-collection

basically all "custom" properties of a file go to metadata object.

this recently changed in mongodb (don't remember in which version). our upgrade to mongodb java driver 3.4 led to this change.

the 'contentType' is automatically detected by restheart using apache tika

the contentType is set between the metadata properties (and not as the first level contentType property) since the new mongodb driver lacks a method to actually set it.

grossmueller-espirit commented 7 years ago

Thank you!