incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <j...@couchbase.com>
Subject Re: problem with document keys starting with numbers
Date Mon, 02 Jan 2012 21:16:26 GMT

On Jan 2, 2012, at 1:08 PM, mete wrote:

function(doc) {
emit(doc.x, {'id':doc.id,'x':doc.x})
}

If x is "x" or "x123" etc its fine but

if x is "2v2" or "5abcd" etc.. i get the "Expression does not eval to a
function." error. Any ideas?

If you mean that you’re literally writing “doc.2v2”, that’s not legal JavaScript,
so you’re getting a syntax error.
Use “doc[‘2v2’]” instead; it’s equivalent.

—Jens

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message