c# - Using $all and match patterns -


i have collection in mongodb, each document contains array called "tags" distinct, lowercase array of strings. have distinct array of strings(called t on). query finds every document have similar entry in it's "tags" array every element in t.

this working query:

{     "tags" : {         "$all" : [             /foo/,             /bar/         ]     } } 

how execute query c#?

here query came with:

return item in items.asqueryable()        t.all(t => item.tags.contains(t))        select item; 

this want. problem uses equality operator, matching elements in item.tags , t must same:

{     "tags" : {         "$all" : [             "foo",             "bar"         ]     } } 

my other attempt looked this:

return item in items.asqueryable()        t.all(t => item.tags.all(tag => tag.contains(t))        select item; 

however resulted in unsupported operation exception, guess because $regex inside $all not allowed.

update:

i use filterdefinition object , assign string representation of query. way?


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -