used sort, limit and skip to make a query to db