MikeThomsen commented on code in PR #6460:
URL: https://github.com/apache/nifi/pull/6460#discussion_r1002258419


##########
nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/gridfs/PutGridFS.java:
##########
@@ -212,9 +267,10 @@ private boolean canUploadFile(ProcessContext context, 
FlowFile input, String buc
 
             Document query;
             if (uniqueness.equals(UNIQUE_BOTH.getValue())) {
-                query = new Document().append("filename", 
fileName).append("md5", hash);
+                query = new Document().append("filename", fileName)
+                        .append("metadata", new Document(hashMetadataName, 
hash));
             } else if (uniqueness.equals(UNIQUE_HASH.getValue())) {
-                query = new Document().append("md5", hash);
+                query = new Document().append("metadata", new 
Document(hashMetadataName, hash));

Review Comment:
   Yes and no. People who were relying on the `md5` attribute will have to come 
up with a new way of handling that on their existing data if they migrate it to 
our new approach. I think that can be mitigated by putting a notice in the 
migration guide. As you can see here, it does write the hash (which supports 
EL) as an attribute of the GridFS file metadata entry:
   
   ```
   docker-rs:PRIMARY> db.put_test_bucket.files.find({}).pretty();
   {
        "_id" : ObjectId("63532d0d56f7f5713dec57d6"),
        "filename" : "test_duplicates.txt",
        "length" : NumberLong(12),
        "chunkSize" : 262144,
        "uploadDate" : ISODate("2022-10-21T23:36:45.656Z"),
        "metadata" : {
                "hash" : "bc6e6f16b8a077ef5fbc8d59d0b931b9"
        }
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to