AggregateOptions.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* Copyright 2015-2016 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 MongoDB.Driver.Core.Misc;
  17. namespace MongoDB.Driver
  18. {
  19. /// <summary>
  20. /// Options for an aggregate operation.
  21. /// </summary>
  22. public class AggregateOptions
  23. {
  24. // fields
  25. private bool? _allowDiskUse;
  26. private int? _batchSize;
  27. private bool? _bypassDocumentValidation;
  28. private Collation _collation;
  29. private TimeSpan? _maxTime;
  30. private ExpressionTranslationOptions _translationOptions;
  31. private bool? _useCursor;
  32. // properties
  33. /// <summary>
  34. /// Gets or sets a value indicating whether to allow disk use.
  35. /// </summary>
  36. public bool? AllowDiskUse
  37. {
  38. get { return _allowDiskUse; }
  39. set { _allowDiskUse = value; }
  40. }
  41. /// <summary>
  42. /// Gets or sets the size of a batch.
  43. /// </summary>
  44. public int? BatchSize
  45. {
  46. get { return _batchSize; }
  47. set { _batchSize = Ensure.IsNullOrGreaterThanOrEqualToZero(value, nameof(value)); }
  48. }
  49. /// <summary>
  50. /// Gets or sets a value indicating whether to bypass document validation.
  51. /// </summary>
  52. public bool? BypassDocumentValidation
  53. {
  54. get { return _bypassDocumentValidation; }
  55. set { _bypassDocumentValidation = value; }
  56. }
  57. /// <summary>
  58. /// Gets or sets the collation.
  59. /// </summary>
  60. public Collation Collation
  61. {
  62. get { return _collation; }
  63. set { _collation = value; }
  64. }
  65. /// <summary>
  66. /// Gets or sets the maximum time.
  67. /// </summary>
  68. public TimeSpan? MaxTime
  69. {
  70. get { return _maxTime; }
  71. set { _maxTime = value; }
  72. }
  73. /// <summary>
  74. /// Gets or sets the translation options.
  75. /// </summary>
  76. public ExpressionTranslationOptions TranslationOptions
  77. {
  78. get { return _translationOptions; }
  79. set { _translationOptions = value; }
  80. }
  81. /// <summary>
  82. /// Gets or sets a value indicating whether to use a cursor.
  83. /// </summary>
  84. public bool? UseCursor
  85. {
  86. get { return _useCursor; }
  87. set { _useCursor = value; }
  88. }
  89. }
  90. }