0

I would like to know how can I check the existence of two objects with mongoDB and C#.

I know how to do it for 1 object:

foreach (BsonDocument item in collection.Find(Query.Exists("Boiling point")))

But i have no idea how to check on two objects.

Thanks!

4

1 回答 1

1

You can use Query.And to search more than one condition.

foreach (BsonDocument item in collection.Find(
    Query.And(
        Query.Exists("Boiling point"), 
        Query.Exists("Freezing Point")))

A complete list is available in the online documentation here.

于 2013-08-31T00:38:54.900 回答