Answers for "Check if value is in mongodb collection"

0

Check if value is in mongodb collection

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.")
}
Posted by: Guest on July-26-2021

Code answers related to "Check if value is in mongodb collection"

Browse Popular Code Answers by Language