fluent-mongo
fluent-mongo copied to clipboard
Any still not working
Hi ! I already have seen similar problem (see issue #2 - closed), but I can't find some resolution. Help please!
MongoCollection<Doc> coll = db.GetCollection<Doc>("xxx"); var items = coll.AsQueryable().Where(p => p.boundary != null).Where( p => p.boundary.Any(s => s == "zzz")). Select(p => new Doc { _id = p._id, strArray = p.strArray}).ToArray();
[Serializable]
public class Doc : IMongoQuery
{
public int _id { get; set; }
public string [] strArray { get; set; }
}
Exception :
QueryFailure flag was invalid parameter: expected an object ($elemMatch) (response was { "$err" : "invalid parameter: expected an object ($elemMatch)", "code" : 10065 }).
Possibly related, I've found that nested expression in Any worked in 1.2.0 but is broken in 1.3.1.1.
Referring to $elemMatch documentation on the wiki, this would be an equivalent LINQ expression:
var people = collection.AsQueryable().Where(x => x.Addresses.Any(a => a.City == "Paris" && a.Country == "France"));