code tweak - use $lookup.simple

pull/9930/head
Thibault Duplessis 2021-10-04 08:02:26 +02:00
parent 6e0621b016
commit 8c84ff3496
1 changed files with 6 additions and 10 deletions

View File

@ -36,19 +36,15 @@ final class PuzzleBatch(colls: PuzzleColls, anonApi: PuzzleAnon, pathApi: Puzzle
Unwind("puzzleId"),
Sample(nb),
PipelineOperator(
$doc(
"$lookup" -> $doc(
"from" -> colls.puzzle.name.value,
"localField" -> "puzzleId",
"foreignField" -> "_id",
"as" -> "puzzle"
)
$lookup.simple(
from = colls.puzzle,
local = "puzzleId",
foreign = "_id",
as = "puzzle"
)
),
PipelineOperator(
$doc(
"$replaceWith" -> $doc("$arrayElemAt" -> $arr("$puzzle", 0))
)
$doc("$replaceWith" -> $doc("$arrayElemAt" -> $arr("$puzzle", 0)))
)
)
}.map {