[JAVA-3859] aggregation with lookup fails with 2 non-encrypted collections if CSFLE is enabled Created: 15/Oct/20  Updated: 06/Oct/21  Resolved: 20/Oct/20

Status: Closed
Project: Java Driver
Component/s: Client Side Encryption
Affects Version/s: 3.12.7, 4.1.1
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Anu Madan Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-50092 [FLE] with encryption on collection a... Backlog

 Description   

An aggregation pipeline $lookup fails even if the 2 involved collections are unencrypted. The underlying connection has csfle enabled since the same connection is used to work on the collections with the encrypted fields.
Exception received:
Exception in encryption library: Command failed with error 51204 (Location51204): 'Pipeline over an encrypted collection cannot reference additional collections.' on server localhost:27020. The full response is

{"ok": 0.0, "errmsg": "Pipeline over an encrypted collection cannot reference additional collections.", "code": 51204, "codeName": "Location51204"}

code snippet:
Bson lookup = new Document("$lookup",
new Document("from", "samplecollection1")
.append("localField", "field1")
.append("foreignField", "field2")
.append("as", "samplecollection1"));

List<Bson> filters = new ArrayList<>();
filters.add(lookup);

MongoCollection<Document> collection = encryptedClient.getDatabase(recordsDb).getCollection("samplecollection2");
AggregateIterable<Document> it = collection.aggregate(filters);

for (Document row : it)

{ System.out.println(row.toJson()); }

Note: the aggregation works fine if the connection is created without csfle options.



 Comments   
Comment by Guilherme Terra [ 06/Oct/21 ]

Thank you. I can access the ticket now.

Comment by Jeffrey Yemin [ 06/Oct/21 ]

There was an oversight on an automation configuration update but that change has been reverted and SERVER-50092 is now accessible again. We apologize for the confusion.  

Comment by Guilherme Terra [ 04/Oct/21 ]

Hi, jeff.yemin@mongodb.com

 

Please, I'm facing the same issue even when I'm not referring to the encrypted collection. Is that being fixed by SERVER-50092? I'm not able to access this ticket.

Thank you very much.

Comment by Jeffrey Yemin [ 15/Oct/20 ]

Added link to the relevant server ticket: SERVER-50092

Comment by Jeffrey Yemin [ 15/Oct/20 ]

Hi anu.madan@idemia.com

Yes, I believe that is the expected behavior. Restrictions on $lookup usage with CSFLE are documented here.

I will inform our product management team of your interest in this.

Generated at Thu Feb 08 09:00:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.