Nested collections

So far, we've focused on pretty simple documents. In practice, however, you're more likely to work with complex JSON structures that mirror your application's object graph. For example, consider the common Customer class. In this case, you have a Customer object, which has a collection of Address objects, as demonstrated in the following C# snippet:

public class Customer { public string FirstName { get; set; } public string LastName { get; set; } public IEnumerable<Address> Addresses { get; set; } } public class Address { public string Street { get; set; } public string City { get; set; } public string Province { get; set; } public string State { get; set; } public string Country { get; set; } public string PostalCode { get; ...

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.