Storing complex types

So far, we've limited our exploration primarily to simple data types such as strings and integers. In a real application, you're more likely to have business objects or other complex types that you will need to store. To Couchbase Server, the values that you store are nothing more than byte arrays. Therefore, the SDKs are able to use their respective language's binary serializer (often called a transcoder) to store any data structures.

Consider an application that stores information on a user profile. In .NET, you might have a data object that looks like this:

public class UserProfile
{
  public string Username { get; set; }
  
  public string Email { get; set; }
}

When you use the .NET client to save an instance of the UserProfile ...

Get Couchbase Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.