Questions tagged [couchrest]

A RESTful CouchDB client for Ruby based on Heroku's RestClient and Couch.js.

CouchRest lightly wraps CouchDB's HTTP API, managing JSON serialization, and remembering the URI-paths to CouchDB's API endpoints so you don't have to.

CouchRest is designed to make a simple base for application and framework-specific object oriented APIs. CouchRest is Object-Mapper agnostic, the parsed JSON it returns from CouchDB shows up as subclasses of Ruby's Hash. Naked JSON, just as it was mean to be.

45 questions
9
votes
1 answer

Couch DB filter by key and sort by another field

In couchdb I need to filter by key and which is done like this. { "_id": "_design/test", "_rev": "6-cef7048c4fadf0daa67005fefe", "language": "javascript", "views": { "all": { "map": "function(doc) { if (doc.blogId)…
Dilshan
  • 3,231
  • 4
  • 39
  • 50
4
votes
1 answer

List all CouchApps in a CouchDB?

Is there a way to list all CouchApps in one CouchDB? I would like to do something like: couchapp list http://domain.tld:5984/content And get back a list of all couchapp names.
jacksoncage
  • 113
  • 3
  • 8
3
votes
1 answer

Recommended use of couchrest model in a multi-tenant app

I'm looking for recommendations on how to implement multi-tenancy with couchrest model in a rails app. For my multi-tenant app, I'm thinking of two options: { edit - removed my ugly options because they'll only confuse future readers } I would like…
2
votes
1 answer

Couchdb bad_utf8_character_code

I am using couchdb through couchrest in a ruby on rails application. When I try to use futon it alerts with a message box saying bad_utf8_character_code. If I try to access records from rails console using Model.all it raises either of 500:internal…
Pravin
  • 6,592
  • 4
  • 42
  • 51
2
votes
1 answer

CouchRest Model use a custom value instead of guid for _id field

I wonder if there is a way to use a custom string value (e.g. name of the object) as the _id field instead of a guid in CouchRest Model. E.g. class Cat < CouchRest::Model::Base property :name end By default, it will use a guid as _id field. But…
PokerIncome.com
  • 1,708
  • 2
  • 19
  • 30
2
votes
1 answer

CouchRest is not validating data types

Given this code : class House < CouchRest::Model::Base use_database DB property :somedumfield, :type => Integer end I can enter either Numeric or Text data; it saves it to the database and no errors are raised; I am using couch-model (which…
Salvador Aceves
  • 348
  • 1
  • 4
  • 13
2
votes
3 answers

CouchRest - checking if document id exists

I've probably just missed it in obvious doco but I can't work out how to check if a doc exists in my db using CouchRest. I tried db.get(id) but that throws a 404 in my application, and it seems kind of silly to have to try/ catch my way around…
Aaron Powell
  • 24,927
  • 18
  • 98
  • 150
1
vote
1 answer

Difficult couchdb query

I have the following query: view.reduce.group_level(5).keys which returns: [["1f9c79a33f399a7937d880c5f31e8dbc", 2011, 12, 29, 13], ["1f9c79a33f399a7937d880c5f31e8dbc", 2011, 12, 29, 14], ["c38332ffc275b6c70bcf06ffc39ddbdd", 2011, 12, 29, 13],…
Michael Koper
  • 9,586
  • 7
  • 45
  • 59
1
vote
1 answer

unique constraint in couchrest-model

What is the best practice in Couchrest for implementing something like a unique constraint. I could do this with the _id , but what if I want to implemnet it on multiple fields, not necesarily as a composite, but even separately. Say for e.g. I…
Sam Wilder
  • 869
  • 1
  • 9
  • 21
1
vote
1 answer

Standalone attachments using CouchRest

Can some one give me an example of using CouchRest to store a standalone attachment in CouchDB? This is for a non Rails project. So something which does not involve CouchRest::Model would be nice. thanks, mano
Manokaran K
  • 320
  • 1
  • 2
  • 11
1
vote
1 answer

Update Couchdb document

I have a Couchdb document id and revision id and I would like to update the document. How can I achieve this using CouchRest? I have tried including "_rev" in "put" as suggested somewhere but that doesn't work. This is what I've tried so far: …
verdure
  • 3,201
  • 6
  • 26
  • 27
1
vote
1 answer

How to add property in module in Rails CouchRest Model to support multiple inheritance?

In my class, I want to include multiple modules. Each module can define its own property to persist in couchDB. Here is an example: module Owner property :name end module Animal property :type end class Cat include Owner include…
PokerIncome.com
  • 1,708
  • 2
  • 19
  • 30
1
vote
1 answer

How to use CouchRest with Sunspot?

I have a problem with integration between CouchRest and Sunspot. When I search the book detail, the result from Sunspot is empty. I try to google it for a long time but no help. Started GET "/books/search?utf8=%E2%9C%93&query=Book of…
cartoonROR
  • 13
  • 3
1
vote
1 answer

Testing errors in Rails with CouchRest Model using RSpec

I have a normal Rails project (without Active Record) using CouchDB (couchrest_model) as a document database. I did setup RSpec and a basic scaffold 'Project'. When I test the following spec: before(:each) do @project = Project.create!…
Christian
  • 1,872
  • 1
  • 14
  • 14
1
vote
1 answer

How to retrieve an object from a CouchDB view using the CouchRest Ruby Gem

Assuming I have a view in my CouchDB named "user/all" and a CouchRest ExtendedDocument as follows: class User < CouchRest::ExtendedDocument property :username property :password property :realname property :role property…
Leynos
  • 549
  • 5
  • 10
1
2 3