incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paola Lorusso <>
Subject create views, ruby instead of javascript
Date Sun, 05 Oct 2008 20:47:53 GMT
Hi ,
I' am trying to use couchdb with ruby. I am using in particular 'couch_object' to interface
ruby with couchdb.
I would ask how I can create views in ruby instead of javascript to query couchdb.
In particular I am interested to faster this query following below that queries a blog db,
where I have posted comments, posts, and authors.

results1 =
     for post in posts 
          id = post["id"] 
          doc = db.get(id).to_document
      if doc["type"] == 'post' and doc["title"][0..1]== /xr/ then results1 = doc end

I have read samewhere that I can optimize the performance using views. May I do that following
this example? 

I have seen same exemples on this URL
,  but when I have tried them there were errors.

I have try to post a view to 
response ="_temp_view", <<EOJS)
      return doc

Infact, I have this problem:
#<CouchObject::Response:0xb6deb370 @response=#<Net::HTTPInternalServerError 500 Internal
Server Error readbody=true>, @parsed_body={"error"=>"query_language_unknown", "reason"=>"application/json"}>

In any case I would prefer to use ruby instead of javascript to query couchdb.

Can you halp me? 


      Scopri il blog di Yahoo! Mail:
Trucchi, novità e la tua opinione.
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message