I am using ArangoDB and I am querying a collection named movies
. Its data structure is such that categories
is a 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 is the query statement:
var result = db.Query<movies>()
.Where(p => p.categories.Contains(id));
id
is passed as a param and I need to retrieve all the movies that has the category matched by the id.
However, above code doesn't work as result
gives me ALL the movies in the collection.
foreach (movies mov in result)
{
if (mov.categories.Contains(id) == false)
{ continue; }
// do something here
}
The weird thing is when I loop through the items in the result, the same function does return false
for some of the items. But it just doesn't work in the Linq statement.
Anybody knows what is wrong with my query statement?