📜  检查值是否在 mongodb 集合中 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:41.561000             🧑  作者: Mango

代码示例1
var result = collection.Find(new BsonDocument("name", "henry")).FirstOrDefault();
if (result != null) 
{
    Console.WriteLine($"This user has been found with the name {collection["name"]}")
}
else 
{
    Console.WriteLine("This user has not been found.")
}