-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 2.4.3, 2.4.4
-
Environment:Win10x64pro
VS2017
enum BE { b0 = 1<<0, b1 = 1<<1, b2 = 1<<2, b3 = 1<<3, b4 = 1<<4, } class BBB { public BE be; } public void foo(IMongoCollection coll) { coll.InsertMany(new [] { new BBB{be=BE.b1}, new BBB{be=BE.b2}, new BBB{be=BE.b3}, new BBB{be=BE.b4}, }); var mask = BE.b1 | BE.b3; var qb1 = coll.FindSync(b => (b.be & mask) != 0); //System.InvalidOperationException: 'Convert(Convert((Convert({document}{be}) & 10))) is not supported.' var qb2 = coll.FindSync(b => (b.be & mask) == 0); //System.InvalidOperationException: 'Convert(Convert((Convert({document}{be}) & 10))) is not supported.' var qb3 = coll.FindSync(b => (b.be & mask) != mask); //System.InvalidOperationException: 'Convert(Convert((Convert({document}{be}) & 10))) is not supported.' var qb4 = coll.FindSync(b => (b.be & mask) == mask); //System.InvalidOperationException: 'Convert(Convert((Convert({document}{be}) & 10))) is not supported.' var q1 = coll.AsQueryable().Where(b => (b.be & mask) != 0).ToList(); //System.InvalidOperationException: 'Convert(Convert((Convert({document}{be}) & 10))) is not supported.' var q2 = coll.AsQueryable().Where(b => (b.be & mask) == 0).ToList(); //System.InvalidOperationException: 'Convert(Convert((Convert({document}{be}) & 10))) is not supported.' var q3 = coll.AsQueryable().Where(b => (b.be & mask) != mask).ToList(); //System.InvalidOperationException: 'Convert(Convert((Convert({document}{be}) & 10))) is not supported.' var q4 = coll.AsQueryable().Where(b => (b.be & mask) == mask).ToList(); //System.InvalidOperationException: 'Convert(Convert((Convert({document}{be}) & 10))) is not supported.' }
Looks like the behavior is different from MongoDB C# Driver documents.