Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-3859

aggregation with lookup fails with 2 non-encrypted collections if CSFLE is enabled

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.12.7, 4.1.1
    • Component/s: Client Side Encryption
    • None

      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.

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            anu.madan@idemia.com Anu Madan
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: