I am attempting to integrate Kotlin JS with the MongoDB Browser SDK. In JavaScript, the SDK supports a function that looks like this:
const someData = db("database")
.collection("stories")
.aggregate(
[
{
$lookup:
{ from: "person",
localField: "person_id",
foreignField: "_id",
as: "people"
}
}
]
)
This is my attempt to convert it into Kotlin:
val aggregate = mapOf(
"\$lookup" to mapOf(
"from" to "people",
"localField" to "people_id",
"foreignField" to "_id",
"as" to "people"
)
)
val someData = mongodb
.db("database")
.collection("stories")
.aggregate(aggregate)
However, I encounter the following error message:
Uncaught RangeError: Maximum call stack size exceeded
Any suggestions on how to resolve this issue?