search - MongoDB field-array searching (C#, How to?) -


Please tell how to search by fields? I have some types of types: list & lt; Int64 & gt; For example, in the first document, field-array numbers are [1,2,3,4] and the second document has such fields [4,5,6,7].

I want to find the documents, there are 3 and 4 numbers in my area, so this is the first document I'm looking for, for example, which are based on official Mongodi C # drivers;)

Thanks a lot!

You should use the query. All () . Code like this:

  var array = new list & lt; Int & gt; () {3, 4}; Var query = query All ("some other", new BSNER (array)); Collection.Find (query); As a result of   

will be aligned to all documents with the array SomeArray values ​​ 3 and 4 .

If you want 3 or 4 to use query. In ("Somewhere", New BSNER (Array))

Document Reference:,

Comments