// public methods
        /// <summary>
        /// Returns the first matching element in the array specified by name.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="query">The query.</param>
        /// <returns>The build (so method calls can be chained).</returns>
        public FieldsBuilder ElemMatch(string name, ISequoiaQuery query)
        {
            var elemMatchDocument = new BsonDocument("$elemMatch", query.ToBsonDocument());

            _document.Add(name, elemMatchDocument);
            return(this);
        }
Esempio n. 2
0
 /// <summary>
 /// Injects a low level IMongoQuery into a LINQ where clause. Can only be used in LINQ queries.
 /// </summary>
 /// <param name="query">The low level query.</param>
 /// <returns>Throws an InvalidOperationException if called.</returns>
 public static bool Inject(this ISequoiaQuery query)
 {
     throw new InvalidOperationException("The LinqToMongo.Inject method is only intended to be used in LINQ Where clauses.");
 }
 // public static methods
 /// <summary>
 /// Returns the first matching element in the array specified by name.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="query">The query.</param>
 /// <returns>The build (so method calls can be chained).</returns>
 public static FieldsBuilder ElemMatch(string name, ISequoiaQuery query)
 {
     return new FieldsBuilder().ElemMatch(name, query);
 }
 // public methods
 /// <summary>
 /// Returns the first matching element in the array specified by name.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="query">The query.</param>
 /// <returns>The build (so method calls can be chained).</returns>
 public FieldsBuilder ElemMatch(string name, ISequoiaQuery query)
 {
     var elemMatchDocument = new BsonDocument("$elemMatch", query.ToBsonDocument());
     _document.Add(name, elemMatchDocument);
     return this;
 }
 // public static methods
 /// <summary>
 /// Returns the first matching element in the array specified by name.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="query">The query.</param>
 /// <returns>The build (so method calls can be chained).</returns>
 public static FieldsBuilder ElemMatch(string name, ISequoiaQuery query)
 {
     return(new FieldsBuilder().ElemMatch(name, query));
 }