[JAVA-3737] Add custom row on GridFs fs.files collection Created: 20/May/20 Updated: 13/Mar/21 Resolved: 02/Jun/20 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | GridFS |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Matteo Pileggi [X] | Assignee: | Ross Lawley |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Description |
|
Hi, I can't find a way with new reactive stream api to add a custom row on fs.files collection of gridfs. On my old (that run in production) I was able to add custom row on
The com.mongodb.reactivestreams.client.gridfs.GridFSBucket only allows to add metadata via GridFSUploadOptions.
But I've 16TB on my mongodb and I can't change the structure of my document. By the way, this customRow, is also my sharding key...
Can you add this features (or suggest me a workaround)?
regards – matpil
|
| Comments |
| Comment by Matteo Pileggi [X] [ 13/Mar/21 ] | ||||||||||||||
|
Finally I solved my problem starting by this link: then I rewrited the GridFS* classes. | ||||||||||||||
| Comment by Matteo Pileggi [X] [ 05/Mar/21 ] | ||||||||||||||
|
Hi, I've tried to create a custom Provider (with a custom codec).
Can you suggest me a way? Regards ps. I know that this issue is closed, but can you answer me anyway? | ||||||||||||||
| Comment by Ross Lawley [ 02/Jun/20 ] | ||||||||||||||
|
Thanks for the ticket, the reactive streams GridFS API adheres to the GridFS Specification title which mandates that metadata is stored in a sub-document, rather than at the top level. The legacy GridFS API doesn't adhere to the spec and that is why you are seeing a difference. However, all isn't necessarily lost as the GridFSFileCodec handles the conversion of the GridFSFile to a BsonDocument. In theory you could register you're own codec to handle GridFSFiles and extract the CUSTOM_ROW metadata and encode that at the top level rather than in the metadata sub document. This would allow you to continue using the same shard key and update to the reactive streams API. I hope that helps, Ross |