I have a collection I am trying to query using the c# driver. the document structure is:
{
"_id" : 3121 ,
"Active" : true ,
"CategoryId" : 1 ,
"Crci" : "IH" ,
"CultureId" : null ,
"DateUpdated" : {
"$date" : 1381916923120
} ,
"Description" : "National Careers Service: Actuary" ,
"Keywords" : "" ,
"MaxLevel" : null ,
"MinLevel" : null ,
"PhoneNumber" : " " ,
"Priority" : 1 ,
"Title" : "National Careers Service: Actuary" ,
"WebUrl" : "https://nationalcareersservice.direct.gov.uk/advice/planning/jobprofiles/Pages/actuary.aspx" ,
"CareerCultureExternalResources" : [
{
"CareerId" : 5 ,
"CultureId" : 1 ,
"DisplayOrder" : 1 ,
"ExternalResourceId" : 3121 ,
"Vgs" : null
}
] ,
"SubjectExternalResources" : [ ] ,
"LifestyleCategories" : null
}
the query I am trying to run is:
collection.AsQueryble().Where(
er =>
er.CareerCultureExternalResources.Any(
ccer => ccer.CareerId == request.CareerId && ccer.CultureId == request.CultureId));
passing the values careerId = 637 and cultureId = 1, I get the error: "Unsupported where clause: ((Int32)ccer.CareerId == 637)"
However on the MongoDb tutorials page it says this kind of query is covered: http://docs.mongodb.org/ecosystem/tutorial/use-linq-queries-with-csharp-driver/
I am using version 1.8.3 of the driver
CareerIdonrequestan Int32?CareerIdis a short and so is the data type for the 'CareerCultureExternalResource. So the data types match but the error doesn't make sense. I'm not sure why it is trying to cast it to anint`int? From a quick read of a few spots around, it sounds like not all data types are supported equally in thewhere.