Class LinqToMongo
This static class holds methods that can be used to express MongoDB specific query operations in LINQ queries.
public static class LinqToMongo
- Inheritance
-
LinqToMongo
- Inherited Members
Methods
ContainsAll<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)
Determines whether a sequence contains all of the specified values.
public static bool ContainsAll<TSource>(this IEnumerable<TSource> source, IEnumerable<TSource> values)
Parameters
sourceIEnumerable<TSource>A sequence in which to locate the values.
valuesIEnumerable<TSource>The values to locate in the sequence.
Returns
- bool
True if the sequence contains all of the specified values.
Type Parameters
TSourceThe type of the elements of source.
ContainsAny<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)
Determines whether a sequence contains any of the specified values.
public static bool ContainsAny<TSource>(this IEnumerable<TSource> source, IEnumerable<TSource> values)
Parameters
sourceIEnumerable<TSource>A sequence in which to locate the values.
valuesIEnumerable<TSource>The values to locate in the sequence.
Returns
- bool
True if the sequence contains any of the specified values.
Type Parameters
TSourceThe type of the elements of source.
In<TSource>(TSource, IEnumerable<TSource>)
Determines whether a specified value is contained in a sequence.
public static bool In<TSource>(this TSource value, IEnumerable<TSource> source)
Parameters
valueTSourceThe value to locate in the sequence.
sourceIEnumerable<TSource>A sequence in which to locate the values.
Returns
- bool
True if the value is contained in the sequence.
Type Parameters
TSourceThe type of the elements of source.
Inject(IMongoQuery)
Injects a low level IMongoQuery into a LINQ where clause. Can only be used in LINQ queries.
public static bool Inject(this IMongoQuery query)
Parameters
queryIMongoQueryThe low level query.
Returns
- bool
Throws an InvalidOperationException if called.
WithIndex<TSource>(IQueryable<TSource>, BsonDocument)
Sets an index hint on the query that's being built.
public static IQueryable<TSource> WithIndex<TSource>(this IQueryable<TSource> source, BsonDocument indexHint)
Parameters
sourceIQueryable<TSource>The query being built.
indexHintBsonDocumentHint for what index to use.
Returns
- IQueryable<TSource>
New query where the expression includes a WithIndex method call.
Type Parameters
TSourceThe type of the elements of source.
WithIndex<TSource>(IQueryable<TSource>, string)
Sets an index hint on the query that's being built.
public static IQueryable<TSource> WithIndex<TSource>(this IQueryable<TSource> source, string indexName)
Parameters
sourceIQueryable<TSource>The query being built.
indexNamestringThe name of the index to use.
Returns
- IQueryable<TSource>
New query where the expression includes a WithIndex method call.
Type Parameters
TSourceThe type of the elements of source.