CountOptions.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 MongoDB.Bson;
  17. using MongoDB.Driver.Core.Misc;
  18. namespace MongoDB.Driver
  19. {
  20. /// <summary>
  21. /// Options for a count operation.
  22. /// </summary>
  23. public sealed class CountOptions
  24. {
  25. // fields
  26. private Collation _collation;
  27. private BsonValue _hint;
  28. private long? _limit;
  29. private TimeSpan? _maxTime;
  30. private long? _skip;
  31. // properties
  32. /// <summary>
  33. /// Gets or sets the collation.
  34. /// </summary>
  35. public Collation Collation
  36. {
  37. get { return _collation; }
  38. set { _collation = value; }
  39. }
  40. /// <summary>
  41. /// Gets or sets the hint.
  42. /// </summary>
  43. public BsonValue Hint
  44. {
  45. get { return _hint; }
  46. set { _hint = value; }
  47. }
  48. /// <summary>
  49. /// Gets or sets the limit.
  50. /// </summary>
  51. public long? Limit
  52. {
  53. get { return _limit; }
  54. set { _limit = value; }
  55. }
  56. /// <summary>
  57. /// Gets or sets the maximum time.
  58. /// </summary>
  59. public TimeSpan? MaxTime
  60. {
  61. get { return _maxTime; }
  62. set { _maxTime = Ensure.IsNullOrInfiniteOrGreaterThanOrEqualToZero(value, nameof(value)); }
  63. }
  64. /// <summary>
  65. /// Gets or sets the skip.
  66. /// </summary>
  67. public long? Skip
  68. {
  69. get { return _skip; }
  70. set { _skip = value; }
  71. }
  72. }
  73. }