Heya,
I've searched all morning for a proper answer or solution but can't
find any. This is more a Kaminari question than MongoID, but they feel
quite related in this case.
All I want to do is to limit my query to 1000 documents. But it seems
like Kaminari overrides or just skips the limit specified.
I've tried a bunch of different variations, but none of them are
working and I just can't find a good answer or solution, via Google,
Stackoverflow or GitHub for example.
Query variations, countries is an array of country iso short codes
['CA', 'SE', 'DE'] for example
-------------------------------------------------
@accounts = Account.any_in(country_short:
countries).limit(100).page(params[:page]).per(20)
@accounts = Account.all(conditions: {:
country_short.in => countries},
limit: 100).page(params[:page]).per(20)
@accounts = Account.where(:
country_short.in =>
countries).limit(100).page(params[:page]).per(20)
These quires returns the expected result, but without the pagination
part of course.
-------------------------------------------------
@accounts = Account.any_in(country_short: countries).limit(100)
@accounts = Account.all(conditions: {:
country_short.in => countries},
limit: 100)
@accounts = Account.where(:
country_short.in => countries).limit(100)
Versions and gems used
--------------------------------------------------
bson (1.6.2)
bson_ext (1.6.2)
mongo (1.6.2)
mongoid (2.4.7)
kaminari (0.13.0)
Would be great if someone could shed some light on this matter. Is it
possible at all? Is it a bug? Am I doing something very wrong? If it
is a bug, is there a work around?