Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FindHasMany is limited to 25 (default) hits #81

Open
afinne opened this issue Aug 16, 2017 · 9 comments
Open

FindHasMany is limited to 25 (default) hits #81

afinne opened this issue Aug 16, 2017 · 9 comments

Comments

@afinne
Copy link

afinne commented Aug 16, 2017

When using ember-pouch (or relational-pouch), when following a hasMany link, it doesn't set an unlimited limit, so I only get the first 25 children

For instance when listing all managers, that have a managerFor relation to technicians (inverse via manager) results in a _find where manager = the id. However, since no limit is included, I only ever get the 25 first technicians for the manager.

The code in question is: https://github.com/pouchdb-community/relational-pouch/blob/master/lib/index.js#L425-L438

@broerse
Copy link
Collaborator

broerse commented Aug 23, 2017

I am not aware there is a limit. Will investigate. On https://bloggr.exmer.com/ it will return more than 25 Posts. See https://bloggr.exmer.com/authors/D8F61FBC-A9C4-0318-851B-228507CDC032 after this record is loaded. https://github.com/broerse/ember-cli-blog/blob/master/app/models/author.js

@afinne
Copy link
Author

afinne commented Aug 25, 2017

Hmm... I wonder if this is only when running against CouchDB: http://docs.couchdb.org/en/2.1.0/api/database/find.html?highlight=limit#db-find

Perhaps PouchDB does not have a default limit?

My scenario is that I use Ember-Pouch running against a PouchDB syncing to CouchDB on the iPad, and in the browser running straight against the same CouchDB.

@broerse
Copy link
Collaborator

broerse commented Aug 25, 2017

We run everything against Cloudant or CouchDB 1.6 and it does not have this limit. I see this limit in your CouchDB 2.1.0 doc but it does not state how to disable it. See also https://stackoverflow.com/questions/45632794/how-to-fetch-unlimited-documents-using-mango-query-couchdb-without-providing-li

@broerse
Copy link
Collaborator

broerse commented Aug 25, 2017

@nolanlawson Is this fixed/addressed in the newest pouch-find.

@broerse
Copy link
Collaborator

broerse commented Aug 29, 2017

@afinne Cloudant has this limit but we never saw it because if you use find on the local pouch it does not have this limit. So it is only the backend that has this limit. We stil need to fix this somewhere. I think this module is perhaps the correct place to fix this and not in pouchdb-find.

@rhysdavies1994
Copy link

rhysdavies1994 commented Mar 27, 2018

I've had this exact same issue using ember-pouch with CouchDB and went through hours of exploration of messing with adapters and scouring through documentation to eventually come to a simple workaround.

As mentioned above, CouchDB 2.1.0 added the default limit. With ember-pouch v5.0.0 you can now set limit on query, but this didn't affect findHasMany for me.

By searching through the apache/couchdb source code I found there is an undocumented mango section in the CouchDB configuration: https://github.com/apache/couchdb/blob/master/rel/overlay/etc/default.ini#L280-L285

Therefore if you don't want a limit, you can just set a high limit under mango.default_limit through Fauxton or by modifying your config file.

@broerse
Copy link
Collaborator

broerse commented Mar 27, 2018

@rhysdavies1994 I did't know that. Not sure this is what we shout advise but until we fix this for findHasMany it is a good workaround.

@muziejus
Copy link

For a bit of clarification on @rhysdavies1994’s workaround: you can enlarge the find default in Fauxton by:

  1. clicking on the gear on the left menu (Config), which takes you to http://127.0.0.1:5984/_utils/#_config/

  2. choosing “Add Option” at the top

  3. Filling in mango for “section,” default_limit for “name” and something large (50000) for “value.” On reload, it should look something like:

Screenshot 2019-04-24 at 13 40 53

@parzibyte
Copy link

@muziejus solution working like a charm. Here's another pic:
imagen
(just put a bigger number in limit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants