🐛 Fix infinite scroll for shared with me (#641)

This commit is contained in:
Montassar Ghanmy
2024-09-05 14:30:27 +01:00
committed by GitHub
parent 492b636e93
commit f14ec8bd2d
10 changed files with 253 additions and 70 deletions
@@ -211,7 +211,12 @@ export default class MongoSearch extends SearchAdapter implements SearchAdapterI
logger.info(`Search query: ${JSON.stringify(query)}`);
console.log(query);
let cursor = collection.find(query).sort(sort);
const sortMapped: any = sort
? Object.fromEntries(
Object.entries(sort).map(([field, direction]) => [field, direction === "asc" ? 1 : -1]),
)
: {};
let cursor = collection.find(query).sort(sortMapped);
if (project) {
cursor = cursor.project(project);
}