ChangeStreamOptions.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* Copyright 2017-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;
  16. using MongoDB.Driver.Core.Misc;
  17. using System;
  18. namespace MongoDB.Driver
  19. {
  20. /// <summary>
  21. /// Options for a change stream operation.
  22. /// </summary>
  23. public class ChangeStreamOptions
  24. {
  25. // private fields
  26. private int? _batchSize;
  27. private Collation _collation;
  28. private ChangeStreamFullDocumentOption _fullDocument = ChangeStreamFullDocumentOption.Default;
  29. private TimeSpan? _maxAwaitTime;
  30. private BsonDocument _resumeAfter;
  31. private BsonTimestamp _startAtOperationTime;
  32. // public properties
  33. /// <summary>
  34. /// Gets or sets the size of the batch.
  35. /// </summary>
  36. /// <value>
  37. /// The size of the batch.
  38. /// </value>
  39. public int? BatchSize
  40. {
  41. get { return _batchSize; }
  42. set { _batchSize = Ensure.IsNullOrGreaterThanZero(value, nameof(value)); }
  43. }
  44. /// <summary>
  45. /// Gets or sets the collation.
  46. /// </summary>
  47. /// <value>
  48. /// The collation.
  49. /// </value>
  50. public Collation Collation
  51. {
  52. get { return _collation; }
  53. set { _collation = value; }
  54. }
  55. /// <summary>
  56. /// Gets or sets the full document.
  57. /// </summary>
  58. /// <value>
  59. /// The full document.
  60. /// </value>
  61. public ChangeStreamFullDocumentOption FullDocument
  62. {
  63. get { return _fullDocument; }
  64. set { _fullDocument = value; }
  65. }
  66. /// <summary>
  67. /// Gets or sets the maximum await time.
  68. /// </summary>
  69. /// <value>
  70. /// The maximum await time.
  71. /// </value>
  72. public TimeSpan? MaxAwaitTime
  73. {
  74. get { return _maxAwaitTime; }
  75. set { _maxAwaitTime = Ensure.IsNullOrGreaterThanZero(value, nameof(value)); }
  76. }
  77. /// <summary>
  78. /// Gets or sets the resume after.
  79. /// </summary>
  80. /// <value>
  81. /// The resume after.
  82. /// </value>
  83. public BsonDocument ResumeAfter
  84. {
  85. get { return _resumeAfter; }
  86. set { _resumeAfter = value; }
  87. }
  88. /// <summary>
  89. /// Gets or sets the start at operation time.
  90. /// </summary>
  91. /// <value>
  92. /// The start at operation time.
  93. /// </value>
  94. public BsonTimestamp StartAtOperationTime
  95. {
  96. get { return _startAtOperationTime; }
  97. set { _startAtOperationTime = value; }
  98. }
  99. }
  100. }