Open
Description
Issue Description
I have two parse classes User and Post. The user class has relation named posts containing Post objects. When i do
the following query
user.relation("posts", className: Post.className) .query(Post()) .limit(5) .order(.descending("createdAt"))
i got less than 5 objects nevertheless the user has more than 5 posts.
Steps to reproduce
- Creates 6 posts, let say post 1, post 2, ..., post 6. Post[i] is created before Post[i+1].
- Delete the last created post (post 6).
- Then run the provided query with limit 5.
Actual Outcome
The query returns post 5, post 4, post 3 and post 2 (total of 4 posts).
Expected Outcome
My expectation is that the query will omit the deleted object and return the first 5 available objects - post 5 up to post 1.
This happens because the join table representing the relation keeps the id of the deleted object. The limit operator gives 5 object ids including the id of the deleted object. I consider this a bug.
Server
- Parse Server version:
4.10.4
- Operating system:
macOS
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc):
Local/Heroku
Database
- System (MongoDB or Postgres):
MongoDB
- Database version:
8.0.4
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc):
MongoDB Atlas
Client
- SDK (iOS, Android, JavaScript, PHP, Unity, etc):
iOS
- SDK version:
3.1.0