Skip to content

Commit

Permalink
[UCMS-11864] Add hint argument to Fish0::Repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Udalov Igor committed May 6, 2024
1 parent 5dd25af commit 8a8c570
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Fish0 0.2.2 (May, 06, 2023) ##

* Added `hint` argument to `Fish0::Repository` in order to force usage of specific index(-es).


## Fish0 0.2.0 (June, 01, 2017) ##

* `config.mongo_hosts` -> `config.mongo_uri`. Now it accepts both Mongo URI as string and Hosts as array.
Expand Down
6 changes: 6 additions & 0 deletions lib/fish0/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ def skip(value)
self
end

def hint(value)
@hint = value
self
end

def scope(name, body)
return if respond_to?(name)

Expand All @@ -105,6 +110,7 @@ def fetch
scoped = scoped.projection(@projection) if @projection
scoped = scoped.skip(skip_quantity) if skip_quantity.positive?
scoped = scoped.limit(limit_quantity) if limit_quantity.positive?
scoped = scoped.hint(@hint) if @hint
scoped
end

Expand Down
2 changes: 1 addition & 1 deletion lib/fish0/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Fish0
VERSION = '0.2.1'.freeze
VERSION = '0.2.2'.freeze
end

0 comments on commit 8a8c570

Please sign in to comment.