Преобразование запроса монго в запрос весны - PullRequest
0 голосов
/ 19 декабря 2018

МОЙ запрос Mongo Cli

  {$project:{"userId":{$setIntersection:["array1","array2"]}}}

Я хочу преобразовать его в проекцию агрегации пружины.

Я пишу следующий запрос

  var intersection=SetOperators.arrayAsSet("array1").intersects("pipe1","pipe2")

  var afterFacetStage=Aggregation.project().and(intersection).`as`("userId")

это эквивалентно

{$project:{"userId":{$setIntersection:["array1","pipe1","pipe2"]}}}

Не ожидается, я не хочу включать arrayAsSet

Spring SetOperator Api

Я нашел другой способ, увидев код класса SetOperator

  var intersectOperation=SetOperators.SetOperatorFactory("array1").intersects("pipe1","pipe2")
    var afterFacetStage1=Aggregation.project().and(intersectOperation).`as`("userId")

все еще генерирует этот запрос, который не ожидается

 {$project:{"userId":{$setIntersection:["array1","pipe1","pipe2"]}}}
...