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<BBB> coll)
|
{
|
var coll = db.GetCollection<BBB>("BBB1");
|
coll.InsertMany(new []
|
{
|
new BBB{be=BE.b0},
|
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.'
|
}
|