parse-community / Parse-SDK-Flutter

The Dart/Flutter SDK for Parse Platform
https://parseplatform.org
Apache License 2.0
574 stars 191 forks source link

QueryBuilders in QueryBuilder.or #793

Open mbfakourii opened 2 years ago

mbfakourii commented 2 years ago

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

Server

Logs

None

parse-github-assistant[bot] commented 2 years ago

Thanks for opening this issue!

mbfakourii commented 1 year ago

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

mtrezza commented 1 year ago

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.