On Nov 5, 2012, at 11:53 AM, Kevin Burton <[email protected]> wrote:
> So if I create a document that already exists how does the database know that > it already exists to give me a 409 error? If you PUT a document, and the body of your request has no ‘_rev’ property, it’s an initial creation of a new document. The request will fail if there is already a document with that ID in the database. (CouchDB can tell this apart from an update request because you didn’t include the document’s existing ‘_rev’ in the request.) If you’re using POST, that by definition always creates a new document (with a randomly-assigned ID), so it’s meaningless to say whether the document already exists. > How do I establish a view? Won't I run into the same problem by creating a > view that already exists (via the DesignDocument)? Sorry, I don’t understand the question. Maybe you should back up and describe what you’re trying to do in more detail. —Jens
