Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #62 from matthiasjakel/master

Massive performance improvement when fetching the first document of a view
  • Loading branch information...
commit 64633b5f477448c35effcd7ae65ef4e79f7ead59 2 parents aa743e7 + 65086ea
@langalex langalex authored
View
1  lib/couch_potato/database.rb
@@ -64,6 +64,7 @@ def view(spec)
# returns the first result from a #view query or nil
def first(spec)
+ spec.view_parameters = spec.view_parameters.merge({:limit => 1})
view(spec).first
end
View
5 lib/couch_potato/view/base_view_spec.rb
@@ -1,8 +1,9 @@
module CouchPotato
module View
class BaseViewSpec
- attr_reader :reduce_function, :list_name, :list_function, :design_document, :view_name,
- :view_parameters, :klass, :options, :language
+ attr_reader :reduce_function, :list_name, :list_function, :design_document, :view_name, :klass, :options, :language
+ attr_accessor :view_parameters
+
private :klass, :options
def initialize(klass, view_name, options, view_parameters)
Please sign in to comment.
Something went wrong with that request. Please try again.