Anton Shishkin
Anton Shishkin

Reputation: 23

How can I use limit() in RESTHeart API?

In Mongo shell I use:

db.org_all.find({$text:{$search:"school"}}).limit(1000)

How to use .limit() in RESTHeart API?

/publicdb/org_all?find={$text:{$search:"school"}}&limit=10 doesn’t work.

Upvotes: 2

Views: 1147

Answers (1)

Andrea Di Cesare
Andrea Di Cesare

Reputation: 1253

In RESTHeart you specify the page and pagesize query parameters.

In your case, you need to specify pagesize=10 (not limit) the request should be:

GET /publicdb/org_all?filter={"$text":{"$search":"school"}}&pagesize=10

You'll find more information on restheart documentation query documents section, including the query parameters filter, page, pagesize and keys (projections)

Upvotes: 3

Related Questions