Book Image

Couchbase Essentials

Book Image

Couchbase Essentials

Overview of this book

Table of Contents (15 chapters)
Couchbase Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

A simple to-do schema


You've learned in previous chapters that schema design in the world of schema-less NoSQL databases tends to derive from the logical or object design of the application layer. As such, we'll start our application development efforts by considering the design of the classes we'll use in our application.

In the simplest case, a to-do app is nothing more than a checklist. To start modeling our schema, we'll limit the design to two properties of a checklist, namely a description and a checkbox. This design is shown in the following C# class:

public class Task
{
  public string Description { get; set; }
  public bool IsComplete { get; set; }
}

In this class, the Description property describes the task to be done. The Boolean property IsComplete simply checks whether the task has been completed. The corresponding JSON document stored in Couchbase mirrors this class:

{
  "description": "Pick up the almond milk",
  "isComplete": false
}

As we build our application, we'll add more...