-1

I have a database X, inside i have plenty of similar documents with a field called "order number" which come with sequential numbers. My question is, i am trying to make a view to show all the order numbers so i make something like

function(doc){ emit(doc.number, doc.order number);}"

But this gives error, so how to access in javascript the field "order number"(with a space in between the two names.

ps. using couchdb 1.6.1

João Mourão
  • 168
  • 1
  • 3
  • 14

1 Answers1

0

Managed to find the answer

In JSON if you need to access a field where the keys has a space you need to do it through [].

e.g. doc['order number']

i got the tip from this answer Accessing JSON object keys having spaces

Community
  • 1
  • 1
João Mourão
  • 168
  • 1
  • 3
  • 14