getAll method
Future<List<Map<String, Object?>>>
getAll(
{ - SelectorBuilder? selector,
- Map<String, Object?>? filter,
- FindOptions? findOptions,
- String? hint,
- int? skip,
- Map<String, Object>? sort,
- int? limit,
- Map<String, Object>? hintDocument,
- Map<String, Object>? projection,
- Map<String, Object>? rawOptions,
})
Implementation
Future<List<Map<String, Object?>>> getAll({
SelectorBuilder? selector,
Map<String, Object?>? filter,
FindOptions? findOptions,
String? hint,
int? skip,
Map<String, Object>? sort,
int? limit,
Map<String, Object>? hintDocument,
Map<String, Object>? projection,
Map<String, Object>? rawOptions,
}) async {
skip ??= 0;
skip = skip < 1 ? null : skip;
var results = <Map<String, Object?>>[];
var result = collection.modernFind(
selector: selector,
filter: filter,
findOptions: findOptions,
hint: hint,
skip: skip,
sort: sort,
limit: limit,
hintDocument: hintDocument,
projection: projection,
rawOptions: rawOptions,
);
List<String>? selectedFields;
if (selector != null && selector.paramFields.isNotEmpty) {
selectedFields = selector.paramFields.keys.toList();
}
await result.forEach((element) {
results.add(toModel(element, selectedFields: selectedFields));
});
return results;
}