'MongoDB in C# - Type not null query

I have collection where each document has two fields:

  1. "Field1" - string value
  2. "Field2" - object value with "Field2.Field3(object).Field4(string)".

Now I'm trying to take all documents for which "Field2.Field3" is not null. When I do sth like this for Field1 then it works:

query = Builders<MyDocument>.Filter.Ne(t => t.Field1, null)

However, when I do the same but for "Field2.Field3":

query = Builders<MyDocument>.Filter.Ne(t => t.Field2.Field3, null)

then I got an error "command find failed". Where is the problem?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source