Noah Slater schrieb:
On Thu, Jan 08, 2009 at 02:21:27PM +0100, Sven Helmberger wrote:
Shouldn't couchdb treat null and undefined values the same?
Well, a "null" value is a way of saying "this doesn't have a value" but when
something is undefined, you don't know if it has a value or not. The difference
is subtle, but it's an important one.
I am aware that there is in fact a difference in javascript, but since
there is no "undefined" keyword for JSON, I would argue that that should
not be the case for JSON and couchdb.
Well, an undefined value is by definition, undefined.
in javascript, "undefined" is a keyword for an undefined value. exactly
the value that doc._rev has when doc has no property _rev.
The absence of an "undefined" keyword leads me to the expectation that
for JSON {} should be the same as {"foo":null}.