Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-83

undefined in an array as a key causes an Erlang error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.7.2, 0.8
    • 0.8.1
    • JavaScript View Server
    • None

    Description

      Whenever a view emits an array containing undefined as a key an Erlang is thrown:

      For example, if there's at least one document in the db without foo being set, the following view

      function(doc) {
      emit([doc.foo], doc);
      }

      triggers

      nocatch,{bad_value,"Cannot encode 'undefined' value as JSON",
      [

      {couch_query_servers,prompt,2}

      ,

      {couch_query_servers,'-map_docs/2-fun-0-',2}

      ,

      {lists,map,2}

      ,

      {couch_query_servers,map_docs,2}

      ,

      {couch_view,view_compute,2}

      ,

      {couch_view,update_group,1}

      ,

      {couch_view,temp_update_loop,2}

      ]}

      OTOH,

      function(doc) {
      emit(doc.foo, doc);
      }

      causes no problems.

      Attachments

        Activity

          People

            cmlenz Christopher Lenz
            rszopa Ryszard Szopa
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: