collectionStats method
Implementation
Future<Map<String, dynamic>> collectionStats(String collectionName) async {
final exists = await _harnFile.exists(collectionName);
if (exists) {
final fileSize = await _harnFile.size(collectionName);
final col = await _harnFile.read(collectionName);
_collections[collectionName] = HarnCollection(
collectionName, jsonDecode(col) as Map<String, dynamic>);
final collection = _collections[collectionName];
final documentCount = collection?.count() ?? 0;
return {
'documentCount': documentCount,
'fileSize': fileSize,
};
} else {
return {'documentCount': 0, 'fileSize': 0};
}
}