You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Jyoti Venkatesh <Jy...@NIIT-Tech.com> on 2010/07/14 20:37:14 UTC

Query relating to Show/List function

I am a newbie to couchDB. I am trying to write a show function.
Following is my sample document, which i have saved as record1.json.


{
 "parent1type" : "1",
 "parent1property" : [
    {"heading":"System Performance","level":"1","open":"true","icon":"green","nochild":"false","child":"true","visible":"true"},
    {"heading":"SAP R3","level":"1","open":"true","icon":"green","nochild":"true","child":"false","visible":"true"}
    ],
 "parent2type" : "2"
}


Following is my sample show function, which i have saved as recshow.json
{
  "xmlshows": {
    "toxml": "function(doc, req) {
    var BasicData = <BasicData />;
    BasicData.@parent1type = doc.parent1type;

    return {
    'body': BasicData.toXMLString(),
    'headers': {
     'Content-Type': 'application/xml'
    }
   }
  }"
 }
}

I put this in couchdb using curl. But when i use GET to show my document. I am getting this following error.
{"error":"unnamed_error","reason":"(new TypeError(\"point is undefined\", \"../s
hare/couchdb/server/main.js\", 1388))"}

Where am i going wrong..??


Regards
J

DISCLAIMER

The content of this email and any attachments ('email') is confidential, may be privileged, subject to copyright and may be read and used only by the intended recipient. If you are not the intended recipient please notify us by return email or telephone and erase all copies and do not disclose the email or any part of it to any person. Email transmission cannot be guaranteed to be secure, or error free as information could be intercepted, corrupted, lost or destroyed as a result of the transmission process. The sender, therefore, does not accept liability for any errors, omissions, viruses or delay in transmission as a result of this mail.  We monitor email communications through our networks for regulatory compliance purposes and to protect our clients, employees and business. Opinions, conclusions, and other information in this message that do not relate to the official business of NIIT Technologies Ltd. or its affiliate(s) shall be understood to be neither given nor endorsed by NIIT Technologies Ltd. or its affiliate(s).

RE: Query relating to Show/List function

Posted by Nils Breunese <N....@vpro.nl>.
I'd advise you to use JSON boolean values true and false instead of the strings "true" and "false". If you ever want to implement logic using these properties, that'll come in handy and it's just less data to store.

On your XML rendering problem: I'm not sure what's going on there. I guess you already found http://wiki.apache.org/couchdb/Formatting_with_Show_and_List and http://books.couchdb.org/relax/design-documents/shows

You also might want to check out couchapp, which makes it really easy to manage design documents: http://wiki.github.com/couchapp/couchapp/manual-2

Nils.
________________________________________
Van: Jyoti Venkatesh [Jyoti.Venkatesh@NIIT-Tech.com]
Verzonden: woensdag 14 juli 2010 20:37
Aan: user@couchdb.apache.org; dev@couchdb.apache.org
Onderwerp: Query relating to Show/List function

I am a newbie to couchDB. I am trying to write a show function.
Following is my sample document, which i have saved as record1.json.


{
 "parent1type" : "1",
 "parent1property" : [
    {"heading":"System Performance","level":"1","open":"true","icon":"green","nochild":"false","child":"true","visible":"true"},
    {"heading":"SAP R3","level":"1","open":"true","icon":"green","nochild":"true","child":"false","visible":"true"}
    ],
 "parent2type" : "2"
}


Following is my sample show function, which i have saved as recshow.json
{
  "xmlshows": {
    "toxml": "function(doc, req) {
    var BasicData = <BasicData />;
    BasicData.@parent1type = doc.parent1type;

    return {
    'body': BasicData.toXMLString(),
    'headers': {
     'Content-Type': 'application/xml'
    }
   }
  }"
 }
}

I put this in couchdb using curl. But when i use GET to show my document. I am getting this following error.
{"error":"unnamed_error","reason":"(new TypeError(\"point is undefined\", \"../s
hare/couchdb/server/main.js\", 1388))"}

Where am i going wrong..??


Regards
J

DISCLAIMER

The content of this email and any attachments ('email') is confidential, may be privileged, subject to copyright and may be read and used only by the intended recipient. If you are not the intended recipient please notify us by return email or telephone and erase all copies and do not disclose the email or any part of it to any person. Email transmission cannot be guaranteed to be secure, or error free as information could be intercepted, corrupted, lost or destroyed as a result of the transmission process. The sender, therefore, does not accept liability for any errors, omissions, viruses or delay in transmission as a result of this mail.  We monitor email communications through our networks for regulatory compliance purposes and to protect our clients, employees and business. Opinions, conclusions, and other information in this message that do not relate to the official business of NIIT Technologies Ltd. or its affiliate(s) shall be understood to be neither given nor endorsed by NIIT Technologies Ltd. or its affiliate(s).

De informatie vervat in deze  e-mail en meegezonden bijlagen is uitsluitend bedoeld voor gebruik door de geadresseerde en kan vertrouwelijke informatie bevatten. Openbaarmaking, vermenigvuldiging, verspreiding en/of verstrekking van deze informatie aan derden is voorbehouden aan geadresseerde. De VPRO staat niet in voor de juiste en volledige overbrenging van de inhoud van een verzonden e-mail, noch voor tijdige ontvangst daarvan.