AggregateBucketResult.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Copyright 2016-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 MongoDB.Bson.Serialization.Attributes;
  16. namespace MongoDB.Driver
  17. {
  18. /// <summary>
  19. /// Represents the result of the $bucket stage.
  20. /// </summary>
  21. /// <typeparam name="TValue">The type of the value.</typeparam>
  22. public class AggregateBucketResult<TValue>
  23. {
  24. // constructors
  25. /// <summary>
  26. /// Initializes a new instance of the <see cref="AggregateBucketResult{TValue}"/> class.
  27. /// </summary>
  28. /// <param name="id">The inclusive lower boundary of the bucket.</param>
  29. /// <param name="count">The count.</param>
  30. public AggregateBucketResult(TValue id, long count)
  31. {
  32. Id = id;
  33. Count = count;
  34. }
  35. // public properties
  36. /// <summary>
  37. /// Gets the inclusive lower boundary of the bucket.
  38. /// </summary>
  39. /// <value>
  40. /// The inclusive lower boundary of the bucket.
  41. /// </value>
  42. [BsonId]
  43. public TValue Id { get; private set; }
  44. /// <summary>
  45. /// Gets the count.
  46. /// </summary>
  47. /// <value>
  48. /// The count.
  49. /// </value>
  50. [BsonElement("count")]
  51. public long Count { get; private set; }
  52. }
  53. }