/driver-async/src/main/com/mongodb/async/client/gridfs/GridFSFindIterable.java

https://github.com/d5nguyenvan/mongo-java-driver · Java · 116 lines · 17 code · 12 blank · 87 comment · 0 complexity · 804c3e33a0b36109f80c92b6a8cf33f0 MD5 · raw file

  1. /*
  2. * Copyright 2015 MongoDB, Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.mongodb.async.client.gridfs;
  17. import com.mongodb.async.client.MongoIterable;
  18. import com.mongodb.client.gridfs.model.GridFSFile;
  19. import com.mongodb.client.model.Collation;
  20. import org.bson.conversions.Bson;
  21. import java.util.concurrent.TimeUnit;
  22. /**
  23. * Iterable for the GridFS Files Collection.
  24. *
  25. * @since 3.3
  26. */
  27. public interface GridFSFindIterable extends MongoIterable<GridFSFile> {
  28. /**
  29. * Sets the query filter to apply to the query.
  30. * <p>
  31. * Below is an example of filtering against the filename and some nested metadata that can also be stored along with the file data:
  32. * <pre>
  33. * {@code
  34. * Filters.and(Filters.eq("filename", "mongodb.png"), Filters.eq("metadata.contentType", "image/png"));
  35. * }
  36. * </pre>
  37. *
  38. * @param filter the filter, which may be null.
  39. * @return this
  40. * @mongodb.driver.manual reference/method/db.collection.find/ Filter
  41. * @see com.mongodb.client.model.Filters
  42. */
  43. GridFSFindIterable filter(Bson filter);
  44. /**
  45. * Sets the limit to apply.
  46. *
  47. * @param limit the limit, which may be null
  48. * @return this
  49. * @mongodb.driver.manual reference/method/cursor.limit/#cursor.limit Limit
  50. */
  51. GridFSFindIterable limit(int limit);
  52. /**
  53. * Sets the number of documents to skip.
  54. *
  55. * @param skip the number of documents to skip
  56. * @return this
  57. * @mongodb.driver.manual reference/method/cursor.skip/#cursor.skip Skip
  58. */
  59. GridFSFindIterable skip(int skip);
  60. /**
  61. * Sets the sort criteria to apply to the query.
  62. *
  63. * @param sort the sort criteria, which may be null.
  64. * @return this
  65. * @mongodb.driver.manual reference/method/cursor.sort/ Sort
  66. */
  67. GridFSFindIterable sort(Bson sort);
  68. /**
  69. * The server normally times out idle cursors after an inactivity period (10 minutes)
  70. * to prevent excess memory use. Set this option to prevent that.
  71. *
  72. * @param noCursorTimeout true if cursor timeout is disabled
  73. * @return this
  74. */
  75. GridFSFindIterable noCursorTimeout(boolean noCursorTimeout);
  76. /**
  77. * Sets the maximum execution time on the server for this operation.
  78. *
  79. * @param maxTime the max time
  80. * @param timeUnit the time unit, which may not be null
  81. * @return this
  82. * @mongodb.driver.manual reference/method/cursor.maxTimeMS/#cursor.maxTimeMS Max Time
  83. */
  84. GridFSFindIterable maxTime(long maxTime, TimeUnit timeUnit);
  85. /**
  86. * Sets the number of documents to return per batch.
  87. *
  88. * @param batchSize the batch size
  89. * @return this
  90. * @mongodb.driver.manual reference/method/cursor.batchSize/#cursor.batchSize Batch Size
  91. */
  92. @Override
  93. GridFSFindIterable batchSize(int batchSize);
  94. /**
  95. * Sets the collation options
  96. *
  97. * <p>A null value represents the server default.</p>
  98. * @param collation the collation options to use
  99. * @return this
  100. * @since 3.4
  101. * @mongodb.server.release 3.4
  102. */
  103. GridFSFindIterable collation(Collation collation);
  104. }