Skip to content

aggregate function lookup does work across collections  #231

@Darkvater

Description

@Darkvater

When doing a $lookup where the foreign field is a property on a collection flapdoodle does not return a result. Using latest 1.45.0 version

For example for a data structure like:

data class Data(val key: String, val nestedKeyCollection: List<NestedData>, val nestedKey: NestedData)
data class NestedData(val nestedKey: String)

the following lookup does not work and there are no results for nestedKeyCollection.nestedKey

db.getCollection("data").aggregate(
  lookup(
    from = "someCollection",
    localField = "someKey",
    foreignField = "nestedKeyCollection.nestedKey",
    newAs = "output",
  ),
)

If however the foreign field (nestedKey.nestedKey) is a simple property, or even nested property it does work

db.getCollection("data").aggregate(
  lookup(
    from = "someCollection",
    localField = "someKey",
    foreignField = "nestedKey.nestedKey",
    newAs = "output",
  ),
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions