incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brad King" <brk...@gmail.com>
Subject _id and _rev
Date Thu, 12 Jun 2008 14:08:59 GMT
I wanted to get clarity on the _id and _rev fields. As I'm modeling
this out in c#, I want to create a base Document class that I use for
both creating new documents, and updating existing documents. The
question I have is: will it always be OK to include _id and _rev
fields in my POSTs to create new documents, and just set them to null
values. The behavior I see today seems to be that couchdb will ignore
those properties on POST, as I had hoped. Will this always be the case
or is it a bad practice to include those fields?

Otherwise, I need to create separate Document base classes for create
vs. updates. Please tell me if this makes sense:

    // documents have at a minimum the _id and _rev properties
    public abstract class Document : IDocument
    {
        public string _id { get; set; }
        public string _rev { get; set; }
    }

    public class Entity<T> : Document
    {
        public T entityobject;
    }

This way I always store my serialized objects in an entityobject
field, and can use this for all operations.

Mime
View raw message