O'Reilly logo

RavenDB High Performance by Brian Ritchie

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Efficiently storing large chunks of data

While RavenDB is not a general purpose file system, it can efficiently store large data chunks. It is recommended to store files outside the database, but there are situations where RavenDB makes sense. But before we explore the right way, let's look at the wrong way first. Here is a blog post where we just embedded a byte array:

public class Page
{
  public string Id { get; set; }
  public string Title { get; set; }
  public byte[] Picture { get; set; }
}

This will "work" and RavenDB will serialize the byte array using Base64. The problem is that this will bloat our document and every time we retrieve the document we will return the picture as well. So what is the right way? Use attachments! RavenDB contains a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required