This can't really be expressed in standard LINQ because the types involved
(string and BsonRegularExpression) are different. The standard LINQ
Contains extension method (and the analogous LINQ to MongoDB In extension
method) assumes that the value being tested and the source of values to
test against are of the same type.
Inject seems like a good workaround.
Do you feel there should be a way to express this type-mismatched query
directly in LINQ to MongoDB? If so, you could create a new JIRA issue
requesting the feature.
> Is this possible using the "In" linq to mongo extension method?
> I've tried passing the string[] as regex string but no surprise didn't
> work, do I have to use Inject()?
> TIA
> Sam
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
On Monday, October 8, 2012 4:06:19 PM UTC-5, Robert Stam wrote:
> This can't really be expressed in standard LINQ because the types involved > (string and BsonRegularExpression) are different. The standard LINQ > Contains extension method (and the analogous LINQ to MongoDB In extension > method) assumes that the value being tested and the source of values to > test against are of the same type.
> Inject seems like a good workaround.
> Do you feel there should be a way to express this type-mismatched query > directly in LINQ to MongoDB? If so, you could create a new JIRA issue > requesting the feature.
> On Mon, Oct 8, 2012 at 4:44 PM, Sam Martin <sambo...@gmail.com<javascript:> > > wrote:
>> Hi all,
>> think this should be a simple one, but cant suss the syntax.
>> Is this possible using the "In" linq to mongo extension method?
>> I've tried passing the string[] as regex string but no surprise didn't >> work, do I have to use Inject()?
>> TIA >> Sam
>> -- >> You received this message because you are subscribed to the Google >> Groups "mongodb-user" group. >> To post to this group, send email to mongod...@googlegroups.com<javascript:> >> To unsubscribe from this group, send email to >> mongodb-user...@googlegroups.com <javascript:> >> See also the IRC channel -- freenode.net#mongodb
>> Is this possible using the "In" linq to mongo extension method?
>> I've tried passing the string[] as regex string but no surprise didn't
>> work, do I have to use Inject()?
>> TIA
>> Sam
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb