Welcome Guest, you are in: Login

dbones docs


Navigation (ArmChair)

Search the wiki

Persisted Data

Modified on 2017/03/10 17:49 by Dave Categorized as Uncategorized

Table of Contents [Hide/Show]


This page looks into how and what is persisted into the database.


this is more of a note, but important to know.

CouchDB has the concept of Databases, but not collections (this is what Mongo does). all the documents are stored in a database, that is what is used to separate the documents.

JSON Documents

CouchDB stores its documents in JSON.

JSON itself is by default
  • Schemaless, therefor Type-less (mostly).
  • supports string, number, boolean, array and object.
  • uses camel-case for property names.

to ensure we can serialise and de-serialise objects from documents, Armchair uses Newtonsoft (by default), and applies a few rules/conventions.
  • all property names will use camel-case (instead of the MS Pascal default)
  • DateTime is stored in a ISO 8601 string
  • Every object will have a $type property
  • the Id of the object will be renamed to _id
  • the Revision of the object will be renamed to _rev

these small conventions will then
  • comply with normal JSON conventions
  • allow armchair to know the types it is dealing with.


As mentioned above, JSON does not support strongly typed objects, beyond a few basic ones. in order for ArmChair to deserialise and also search by .NET Type (for example when you use the LINQ statements) it stores a extra property called $type on each object in the graph.

  "_id": "p1",
  "_rev": "1-0232ef350f46937cbfd2173f44bb514f",
  "$type": "ArmChair.Tests.Domain.Sample1.Person, ArmChair.Tests.Domain",
  "name": "dave",
  "birthDate": "1982-01-01T00:00:00"

from this you will note only the objects type is stored, not any other type it inherits. this is by design.

the main reason is when refactoring inheritance trees, it adds complications such as if we remove a base class, then we would need to update all documents which reference it.
dbones docs, is a sub-site of dbones.co.uk, all its content belongs to dbones.co.uk, this also includes logo's.