c# - Linq List Contains -


i using arangodb , querying collection named movies. data structure such categories list of strings.

public class movies {     [documentproperty(identifier = identifiertype.key)]     public string key;     public list<string> categories;     public string desc;     public string img;     public list<vod_stream> streams;     public string title; }; 

here query statement:

var result = db.query<movies>()             .where(p => p.categories.contains(id)); 

id passed param , need retrieve movies has category matched id. however, above code doesn't work result gives me movies in collection.

foreach (movies mov in result) {     if (mov.categories.contains(id) == false)     { continue; }      // here } 

the weird thing when loop through items in result, same function return false of items. doesn't work in linq statement.

anybody knows wrong query statement?

for using aql functions in arangodb linq provider should use arangodb.client.aql static methods.

for use-case can use in aql function:

var result = db.query<movies>()                 .where(p => aql.in(id, p.categories))                 .tolist(); 

which translates :

for `p` in `movies`  filter  @p1 in `p`.`categories`  return   `p` 

built-in methods c# data structures list not supported in arangodb linq provider


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -