public class Test
{
public ObjectId Id { get; set; }
public string[] Tag { get; set; }
}
var client = new MongoClient();
var db = client.GetDatabase("db");
var bsonColl = db.GetCollection<BsonDocument>("coll");
bsonColl.InsertMany(
new []
{
BsonDocument.Parse(@"{
""Tag"" : [
""null"",
""null"",
""null""
]
}"),
BsonDocument.Parse(@"{
""Tag"" : [
""null"",
""null"",
""Test""
]
}")
});
var typedColl = db.GetCollection<Test>("coll");
var result = typedColl.AsQueryable().Where(c => !c.Tag.Any(t => t != "null")).ToList();
also, it’s better to specify null in the document without quotes, then you will be able to have more good looking filtering: .Where(c => !c.Tag.Any(t => t != null))