RLMFindOptions.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. ////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2020 Realm Inc.
  4. //
  5. // Licensed under the Apache License, Version 2.0 (the "License");
  6. // you may not use this file except in compliance with the License.
  7. // You may obtain a copy of the License at
  8. //
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing, software
  12. // distributed under the License is distributed on an "AS IS" BASIS,
  13. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. // See the License for the specific language governing permissions and
  15. // limitations under the License.
  16. //
  17. ////////////////////////////////////////////////////////////////////////////
  18. #import <Realm/RLMConstants.h>
  19. RLM_HEADER_AUDIT_BEGIN(nullability, sendability)
  20. @protocol RLMBSON;
  21. /// Options to use when executing a `find` command on a `RLMMongoCollection`.
  22. @interface RLMFindOptions : NSObject
  23. /// The maximum number of documents to return. Specifying 0 will return all documents.
  24. @property (nonatomic) NSInteger limit;
  25. /// Limits the fields to return for all matching documents.
  26. @property (nonatomic, nullable) id<RLMBSON> projection NS_REFINED_FOR_SWIFT;
  27. /// The order in which to return matching documents.
  28. @property (nonatomic, nullable) id<RLMBSON> sort NS_REFINED_FOR_SWIFT
  29. __attribute__((deprecated("Use `sorting` instead, which correctly sort more than one sort attribute", "sorting")));
  30. /// The order in which to return matching documents.
  31. @property (nonatomic) NSArray<id<RLMBSON>> *sorting NS_REFINED_FOR_SWIFT;
  32. /// Options to use when executing a `find` command on a `RLMMongoCollection`.
  33. /// @param limit The maximum number of documents to return. Specifying 0 will return all documents.
  34. /// @param projection Limits the fields to return for all matching documents.
  35. /// @param sort The order in which to return matching documents.
  36. - (instancetype)initWithLimit:(NSInteger)limit
  37. projection:(id<RLMBSON> _Nullable)projection
  38. sort:(id<RLMBSON> _Nullable)sort
  39. __attribute__((deprecated("Please use `initWithLimit:projection:sorting:`")))
  40. NS_SWIFT_UNAVAILABLE("Please see FindOption");
  41. /// Options to use when executing a `find` command on a `RLMMongoCollection`.
  42. /// @param projection Limits the fields to return for all matching documents.
  43. /// @param sort The order in which to return matching documents.
  44. - (instancetype)initWithProjection:(id<RLMBSON> _Nullable)projection
  45. sort:(id<RLMBSON> _Nullable)sort __deprecated
  46. __attribute__((deprecated("Please use `initWithProjection:sorting:`")))
  47. NS_SWIFT_UNAVAILABLE("Please see FindOption");
  48. /// Options to use when executing a `find` command on a `RLMMongoCollection`.
  49. /// @param limit The maximum number of documents to return. Specifying 0 will return all documents.
  50. /// @param projection Limits the fields to return for all matching documents.
  51. /// @param sorting The order in which to return matching documents.
  52. - (instancetype)initWithLimit:(NSInteger)limit
  53. projection:(id<RLMBSON> _Nullable)projection
  54. sorting:(NSArray<id<RLMBSON>> *)sorting;
  55. /// Options to use when executing a `find` command on a `RLMMongoCollection`.
  56. /// @param projection Limits the fields to return for all matching documents.
  57. /// @param sorting The order in which to return matching documents.
  58. - (instancetype)initWithProjection:(id<RLMBSON> _Nullable)projection
  59. sorting:(NSArray<id<RLMBSON>> *)sorting;
  60. @end
  61. RLM_HEADER_AUDIT_END(nullability, sendability)