firstDocument method

Future<Map<String, dynamic>> firstDocument()

this method depends on the _id property, so if you inserted a custom _id it will sort by your custom _id and this will cause a mis-sorting

Implementation

Future<Map<String, dynamic>> firstDocument() async {
  var selector = where.limit(1).sortBy('_id');
  var res = await futureFind(selector);
  return res.first;
}