diff --git a/FirServer/FirServer/Utility/MongoHelper.cs b/FirServer/FirServer/Utility/MongoHelper.cs index 9688ab65..a70cf19d 100644 --- a/FirServer/FirServer/Utility/MongoHelper.cs +++ b/FirServer/FirServer/Utility/MongoHelper.cs @@ -132,7 +132,7 @@ public T SelectOne(string collectionName, ProjectionDefinition projection, } var collection = mDatabase.GetCollection(collectionName); var result = collection.Find(filter).Project(projection).FirstOrDefault(); - return BsonSerializer.Deserialize(result); + return result != null ? BsonSerializer.Deserialize(result) : default(T); } public async Task> SelectAsync(string collectionName, Expression> filter)