Parse-SDK-Flutter icon indicating copy to clipboard operation
Parse-SDK-Flutter copied to clipboard

QueryBuilders in QueryBuilder.or

Open mbfakourii opened this issue 3 years ago • 3 comments

New Issue Checklist

Issue Description

QueryBuilders in QueryBuilder.or has a problem when limit is used and does not send the limit value!

Steps to reproduce

I used the following code but it did not send the limit value

QueryBuilder<ParseObject> queryTop = QueryBuilder<ParseObject>(object)
  ..whereLessThanOrEqualTo("createdAt", skip)
  ..setLimit(5);

QueryBuilder<ParseObject> queryBottom = QueryBuilder<ParseObject>(object)
  ..whereGreaterThan("createdAt", skip)
  ..setLimit(5);

query = QueryBuilder.or(
  object,
  [queryBottom,queryTop],
);

query.whereEqualTo('room', room);
query.includeObject(["replay"]);

await query.query();

URL

http://ip:port/api/classes/Message?where={"$or":[{"createdAt":{"$gt":{"__type":"Date","iso":"2022-09-30T14:30:13.658Z"}}},{"createdAt":{"$lte":{"__type":"Date","iso":"2022-09-30T14:30:13.658Z"}}}],"room": {"__type":"Pointer","className":"Room","objectId":"mkS0O2mXpg"}}&include=replay

Finally, because the library did not send the limit, it returned all the data!

Actual Outcome

According to the example above, the output should be about 10 items

Expected Outcome

But the server sent all the data!

Environment

parse_server_sdk_flutter: 3.1.3

Parse Flutter SDK

  • SDK version: 3.1.3
  • Operating system version: 11

Server

  • Parse Server version: 5.2.5

Logs

None

mbfakourii avatar Oct 03 '22 10:10 mbfakourii

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

I tried to solve the problem but it seems like it is a limitation on Parse server side. parse server cannot process or , and and nor with two or severallimit in where

mbfakourii avatar Dec 20 '22 15:12 mbfakourii

Hm, there may be limitations, but we may also be able to lift them with a PR in Parse Server. So I guess we can change this to feature.

mtrezza avatar Dec 20 '22 16:12 mtrezza