I previously wrote about the new attachments feature in RavenDB 4.0. Now it is ready to be seen by outside eyes.
As you can see in the image on the right, documents can now have attached attachments (I’m sorry, couldn’t think about a better way to phrase this). This give you the ability to store binary data inside RavenDB, but not as some free floating value that has only very loose connection to the rest of the system. Those attachments are strongly tied to their parent document, and allow you to store related information easily and right next to the document.
That also means that you can take advantage of RavenDB’s ACID nature and actually make modifications to both attachments and documents at the same time. For example, consider the following code:
Here we get the user’s profile picture, generate a thumbnail from it and then associate both picture and thumbnail with the document, we are also updating the status of the user to indicate that they have a profile picture and then submit it all as one single transaction. That means that you don’t have to sync between different sources.
Attachments in RavenDB are also kept consistent through replication, so you won’t see partial results between nodes, and the attachments themselves are using de-duplication techniques to reduce the amount of storage that we take.
I’m really happy with this feature.
More posts in "RavenDB 4.0" series:
- (04 Jul 2017) Unbounded results sets
- (13 Jun 2017) The etag simplification
- (12 Jun 2017) Data subscriptions, Part II
- (09 Jun 2017) Data subscriptions, Part I
- (19 May 2017) Managing encrypted databases
- (11 May 2017) Working with attachments
- (10 May 2017) Attachments
- (08 May 2017) Full database encryption