private BsonArray RemoveUnsupportedCompressors(BsonArray compressors) { bool isSupported(BsonValue value) => Enum.TryParse <CompressorType>(value.AsString, ignoreCase: true, out var type) && CompressorSource.IsCompressorSupported(type); return(new BsonArray(compressors.Where(isSupported))); }
public void SaveCompressors(string[] compressorNames) { foreach (var compressor in compressorNames) { // NOTE: the 'noop' is also expected by the server if (!Enum.TryParse(compressor, true, out CompressorType compressorType) || !CompressorSource.IsCompressorSupported(compressorType)) { // Keys that aren't supported by a driver MUST be ignored. continue; } _compressors.Add(new CompressorConfiguration(compressorType)); } }