validate method
Implementation
Future<bool> validate() {
//if (fs == null) {
// throw MongoDartError('no fs');
//}
if (md5 == null) {
throw MongoDartError('no md5 stored');
}
var completer = Completer<bool>();
// query for md5 at filemd5
var dbCommand = DbCommand(
fs.database, fs.bucketName, 0, 0, 1, {'filemd5': id}, {'md5': 1});
fs.database.executeDbCommand(dbCommand).then((data) {
if (data.containsKey('md5')) {
completer.complete(md5 == data['md5']);
} else {
completer.complete(false);
}
});
return completer.future;
}