incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pieter van der Eems <>
Subject Re: Question in viewings
Date Mon, 16 Jun 2014 10:29:28 GMT
2014-06-16 12:11 GMT+02:00 Σπύρος Σβορώνος <>:
> Hi everyone,
> I am quite new and i have a relatively simple question for which i do not seem to find
the answer. When i try to view a field that has a name which is a number (e.g. A field named
"123"), if i write something like:
> function(doc)
> {
> If (doc.123)
> { list of args}
> }
> I get an error saying that the expression does not eval to a function. Does anybody know
how can i view a field that has this structure?

The problem you encounter here has to do with javascript.
Javascript does not allow you to do doc.123.
It will allow you to access the "123" of doc by using the alternate syntax:

Try it with :
function (doc) {
  if (doc[123]) {
    // do stuff

It might be a good idea to read more about javascript.
It's a strong but sometimes strange language :-)

With regards,
Pieter van der Eems
Interactive Blueprints

View raw message