symbol/catapult-rest

Account filter endpoint seem not working well.

Closed this issue · 1 comments

it showed around 62 items on the list.
Query with pageSize=100 and pageNumber=1

http://api-01.ap-northeast-1.testnet.symboldev.network:3000/accounts?pageSize=100&pageNumber=1&order=desc&orderBy=balance&mosaicId=2CF403E85507F39E

It showed empty data in pageNumber=2 and pageSize=25

http://api-01.ap-northeast-1.testnet.symboldev.network:3000/accounts?pageSize=25&pageNumber=2&order=desc&orderBy=balance&mosaicId=2CF403E85507F39E

Expected result pageNumber=4 should be empty rather than pageNumber=2

I guess your fix won't work?

The problem occurs because it queries to Mongo twice and skip() is used in the both of the queries.

  • In the first query, it sorts accounts by balance and takes the second page
  • In the second query, it queries data by id so there must be only one page but because of skip() condition it takes the second page, which is blank

So to solve this problem, you can clear pageIndex from the options parameter to queryPagedDocuments