AggregateFluentBase.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. /* Copyright 2010-present MongoDB Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. using System;
  16. using System.Collections.Generic;
  17. using System.Threading;
  18. using System.Threading.Tasks;
  19. using MongoDB.Bson;
  20. using MongoDB.Bson.Serialization;
  21. namespace MongoDB.Driver
  22. {
  23. /// <summary>
  24. /// Base class for implementors of <see cref="IAggregateFluent{TResult}" />.
  25. /// </summary>
  26. /// <typeparam name="TResult">The type of the document.</typeparam>
  27. public abstract class AggregateFluentBase<TResult> : IOrderedAggregateFluent<TResult>
  28. {
  29. /// <inheritdoc />
  30. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
  31. public virtual IMongoDatabase Database
  32. {
  33. get { throw new NotImplementedException(); }
  34. }
  35. /// <inheritdoc />
  36. public abstract AggregateOptions Options { get; }
  37. /// <inheritdoc />
  38. public abstract IList<IPipelineStageDefinition> Stages { get; }
  39. /// <inheritdoc />
  40. public abstract IAggregateFluent<TNewResult> AppendStage<TNewResult>(PipelineStageDefinition<TResult, TNewResult> stage);
  41. /// <inheritdoc />
  42. public abstract IAggregateFluent<TNewResult> As<TNewResult>(IBsonSerializer<TNewResult> newResultSerializer);
  43. /// <inheritdoc />
  44. public virtual IAggregateFluent<AggregateBucketResult<TValue>> Bucket<TValue>(
  45. AggregateExpressionDefinition<TResult, TValue> groupBy,
  46. IEnumerable<TValue> boundaries,
  47. AggregateBucketOptions<TValue> options = null)
  48. {
  49. throw new NotImplementedException();
  50. }
  51. /// <inheritdoc />
  52. public virtual IAggregateFluent<TNewResult> Bucket<TValue, TNewResult>(
  53. AggregateExpressionDefinition<TResult, TValue> groupBy,
  54. IEnumerable<TValue> boundaries,
  55. ProjectionDefinition<TResult, TNewResult> output,
  56. AggregateBucketOptions<TValue> options = null)
  57. {
  58. throw new NotImplementedException();
  59. }
  60. /// <inheritdoc />
  61. public virtual IAggregateFluent<AggregateBucketAutoResult<TValue>> BucketAuto<TValue>(
  62. AggregateExpressionDefinition<TResult, TValue> groupBy,
  63. int buckets,
  64. AggregateBucketAutoOptions options = null)
  65. {
  66. throw new NotImplementedException();
  67. }
  68. /// <inheritdoc />
  69. public virtual IAggregateFluent<TNewResult> BucketAuto<TValue, TNewResult>(
  70. AggregateExpressionDefinition<TResult, TValue> groupBy,
  71. int buckets,
  72. ProjectionDefinition<TResult, TNewResult> output,
  73. AggregateBucketAutoOptions options = null)
  74. {
  75. throw new NotImplementedException();
  76. }
  77. /// <inheritdoc />
  78. public virtual IAggregateFluent<ChangeStreamDocument<TResult>> ChangeStream(ChangeStreamStageOptions options = null)
  79. {
  80. throw new NotImplementedException(); // implemented by subclasses
  81. }
  82. /// <inheritdoc />
  83. public virtual IAggregateFluent<AggregateCountResult> Count()
  84. {
  85. throw new NotImplementedException();
  86. }
  87. /// <inheritdoc />
  88. public virtual IAggregateFluent<TNewResult> Facet<TNewResult>(
  89. IEnumerable<AggregateFacet<TResult>> facets,
  90. AggregateFacetOptions<TNewResult> options = null)
  91. {
  92. throw new NotImplementedException();
  93. }
  94. /// <inheritdoc />
  95. public virtual IAggregateFluent<TNewResult> GraphLookup<TFrom, TConnectFrom, TConnectTo, TStartWith, TAsElement, TAs, TNewResult>(
  96. IMongoCollection<TFrom> from,
  97. FieldDefinition<TFrom, TConnectFrom> connectFromField,
  98. FieldDefinition<TFrom, TConnectTo> connectToField,
  99. AggregateExpressionDefinition<TResult, TStartWith> startWith,
  100. FieldDefinition<TNewResult, TAs> @as,
  101. FieldDefinition<TAsElement, int> depthField,
  102. AggregateGraphLookupOptions<TFrom, TAsElement, TNewResult> options = null)
  103. where TAs : IEnumerable<TAsElement>
  104. {
  105. throw new NotImplementedException();
  106. }
  107. /// <inheritdoc />
  108. public abstract IAggregateFluent<TNewResult> Group<TNewResult>(ProjectionDefinition<TResult, TNewResult> group);
  109. /// <inheritdoc />
  110. public abstract IAggregateFluent<TResult> Limit(int limit);
  111. /// <inheritdoc />
  112. public virtual IAggregateFluent<TNewResult> Lookup<TForeignDocument, TNewResult>(string foreignCollectionName, FieldDefinition<TResult> localField, FieldDefinition<TForeignDocument> foreignField, FieldDefinition<TNewResult> @as, AggregateLookupOptions<TForeignDocument, TNewResult> options)
  113. {
  114. throw new NotImplementedException();
  115. }
  116. /// <inheritdoc />
  117. public virtual IAggregateFluent<TNewResult> Lookup<TForeignDocument, TAsElement, TAs, TNewResult>(
  118. IMongoCollection<TForeignDocument> foreignCollection,
  119. BsonDocument let,
  120. PipelineDefinition<TForeignDocument, TAsElement> lookupPipeline,
  121. FieldDefinition<TNewResult, TAs> @as,
  122. AggregateLookupOptions<TForeignDocument, TNewResult> options = null)
  123. where TAs : IEnumerable<TAsElement>
  124. {
  125. throw new NotImplementedException();
  126. }
  127. /// <inheritdoc />
  128. public abstract IAggregateFluent<TResult> Match(FilterDefinition<TResult> filter);
  129. /// <inheritdoc />
  130. public abstract IAggregateFluent<TNewResult> OfType<TNewResult>(IBsonSerializer<TNewResult> newResultSerializer) where TNewResult : TResult;
  131. /// <inheritdoc />
  132. public virtual IAsyncCursor<TResult> Out(string collectionName, CancellationToken cancellationToken)
  133. {
  134. throw new NotImplementedException();
  135. }
  136. /// <inheritdoc />
  137. public abstract Task<IAsyncCursor<TResult>> OutAsync(string collectionName, CancellationToken cancellationToken);
  138. /// <inheritdoc />
  139. public abstract IAggregateFluent<TNewResult> Project<TNewResult>(ProjectionDefinition<TResult, TNewResult> projection);
  140. /// <inheritdoc />
  141. public virtual IAggregateFluent<TNewResult> ReplaceRoot<TNewResult>(AggregateExpressionDefinition<TResult, TNewResult> newRoot)
  142. {
  143. throw new NotImplementedException();
  144. }
  145. /// <inheritdoc />
  146. public abstract IAggregateFluent<TResult> Skip(int skip);
  147. /// <inheritdoc />
  148. public abstract IAggregateFluent<TResult> Sort(SortDefinition<TResult> sort);
  149. /// <inheritdoc />
  150. public virtual IAggregateFluent<AggregateSortByCountResult<TId>> SortByCount<TId>(AggregateExpressionDefinition<TResult, TId> id)
  151. {
  152. throw new NotImplementedException();
  153. }
  154. /// <inheritdoc />
  155. public virtual IOrderedAggregateFluent<TResult> ThenBy(SortDefinition<TResult> newSort)
  156. {
  157. throw new NotImplementedException();
  158. }
  159. /// <inheritdoc />
  160. public abstract IAggregateFluent<TNewResult> Unwind<TNewResult>(FieldDefinition<TResult> field, IBsonSerializer<TNewResult> newResultSerializer);
  161. /// <inheritdoc />
  162. public virtual IAggregateFluent<TNewResult> Unwind<TNewResult>(FieldDefinition<TResult> field, AggregateUnwindOptions<TNewResult> options)
  163. {
  164. throw new NotImplementedException();
  165. }
  166. /// <inheritdoc />
  167. public virtual IAsyncCursor<TResult> ToCursor(CancellationToken cancellationToken)
  168. {
  169. throw new NotImplementedException();
  170. }
  171. /// <inheritdoc />
  172. public abstract Task<IAsyncCursor<TResult>> ToCursorAsync(CancellationToken cancellationToken);
  173. }
  174. }