You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add assertions and missing Override annotations. Avoid recursive self-call on getClassLoader. Extend documentation.
See #1627
Original pull request: #4389
Copy file name to clipboardExpand all lines: src/main/asciidoc/reference/gridfs.adoc
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,6 @@
3
3
4
4
MongoDB supports storing binary files inside its filesystem, GridFS. Spring Data MongoDB provides a `GridFsOperations` interface as well as the corresponding implementation, `GridFsTemplate`, to let you interact with the filesystem. You can set up a `GridFsTemplate` instance by handing it a `MongoDatabaseFactory` as well as a `MongoConverter`, as the following example shows:
5
5
6
-
7
6
====
8
7
.Java
9
8
[source,java,role="primary"]
@@ -82,7 +81,7 @@ class GridFsClient {
82
81
83
82
@Test
84
83
public void findFilesInGridFs() {
85
-
GridFSFindIterable result = operations.find(query(whereFilename().is("filename.txt")))
84
+
GridFSFindIterable result = operations.find(query(whereFilename().is("filename.txt")));
86
85
}
87
86
}
88
87
----
@@ -110,3 +109,7 @@ class GridFsClient {
110
109
====
111
110
112
111
`GridFsOperations` extends `ResourcePatternResolver` and lets the `GridFsTemplate` (for example) to be plugged into an `ApplicationContext` to read Spring Config files from MongoDB database.
112
+
113
+
NOTE: By default, `GridFsTemplate` obtains `GridFSBucket` once upon the first GridFS interaction.
114
+
After that, the Template instance reuses the cached bucket.
115
+
To use different buckets, from the same Template instance use the constructor accepting `Supplier<GridFSBucket>`.
0 commit comments