FindOneAndDeleteOptions.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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.Driver.Core.Misc;
  17. namespace MongoDB.Driver
  18. {
  19. /// <summary>
  20. /// Options for a findAndModify command to delete an object.
  21. /// </summary>
  22. /// <typeparam name="TDocument">The type of the document.</typeparam>
  23. /// <typeparam name="TProjection">The type of the projection (same as TDocument if there is no projection).</typeparam>
  24. public class FindOneAndDeleteOptions<TDocument, TProjection>
  25. {
  26. // fields
  27. private Collation _collation;
  28. private TimeSpan? _maxTime;
  29. private ProjectionDefinition<TDocument, TProjection> _projection;
  30. private SortDefinition<TDocument> _sort;
  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 maximum time.
  42. /// </summary>
  43. public TimeSpan? MaxTime
  44. {
  45. get { return _maxTime; }
  46. set { _maxTime = Ensure.IsNullOrInfiniteOrGreaterThanOrEqualToZero(value, nameof(value)); }
  47. }
  48. /// <summary>
  49. /// Gets or sets the projection.
  50. /// </summary>
  51. public ProjectionDefinition<TDocument, TProjection> Projection
  52. {
  53. get { return _projection; }
  54. set { _projection = value; }
  55. }
  56. /// <summary>
  57. /// Gets or sets the sort.
  58. /// </summary>
  59. public SortDefinition<TDocument> Sort
  60. {
  61. get { return _sort; }
  62. set { _sort = value; }
  63. }
  64. }
  65. /// <summary>
  66. /// Options for a findAndModify command to delete an object.
  67. /// </summary>
  68. /// <typeparam name="TDocument">The type of the document and the result.</typeparam>
  69. public class FindOneAndDeleteOptions<TDocument> : FindOneAndDeleteOptions<TDocument, TDocument>
  70. {
  71. }
  72. }