modernFind method
Stream<Map<String, dynamic> >
modernFind({
- SelectorBuilder? selector,
- Map<
String, Object?> ? filter, - Map<
String, Object> ? sort, - Map<
String, Object> ? projection, - String? hint,
- Map<
String, Object> ? hintDocument, - int? skip,
- int? limit,
- FindOptions? findOptions,
- Map<
String, Object> ? rawOptions,
inherited
Implementation
Stream<Map<String, dynamic>> modernFind(
{SelectorBuilder? selector,
Map<String, Object?>? filter,
Map<String, Object>? sort,
Map<String, Object>? projection,
String? hint,
Map<String, Object>? hintDocument,
int? skip,
int? limit,
FindOptions? findOptions,
Map<String, Object>? rawOptions}) {
if (!db.masterConnection.serverCapabilities.supportsOpMsg) {
throw MongoDartError('At least MongoDb version 3.6 is required '
'to run the find operation');
}
var sortMap = sort;
if (sortMap == null && selector?.map[keyOrderby] != null) {
sortMap = <String, Object>{...selector!.map[keyOrderby]};
}
var operation = FindOperation(this,
filter:
filter ?? (selector?.map == null ? null : selector!.map[key$Query]),
sort: sortMap,
projection: projection ?? selector?.paramFields,
hint: hint,
hintDocument: hintDocument,
limit: limit ?? selector?.paramLimit,
skip: skip ??
(selector != null && selector.paramSkip > 0
? selector.paramSkip
: null),
findOptions: findOptions,
rawOptions: rawOptions);
return ModernCursor(operation).stream;
}