Home > database >  Spring mongotemplare aggregation query problem.
Spring mongotemplare aggregation query problem.

Time:09-21

A tricky question, using aggregation query.
As the lookup table, A table, B asName for asb
Need to show: A, A, b, c fields and table of asb. A, asb. B.a sb. C
With the spring mongoTemplate.
Thought asb. Can a normal build mongo statements, but the actual query for now: $project (a: 1, b: 1, c: 1, a: $asb. A, b: $asb. B, c: $asb. C), clearly wrong, there is something wrong with the query.
The master met this kind of situation, how to adjust to get correct statement?
Or have this kind of table query example line, online example queries only one layer, almost what I need is even

CodePudding user response:

For example I use this statement, then join the Agregation
ProjectionOperation ProjectionOperation=Aggregation. Project (new String [] {" a ", "b", "c", "asb. A"});
The last
I was meant to query $project {a: 1, b: 1, c: 1, asb. A: 1}
But the results will be mongoTemplate into $project {a: 1, b: 1, c: 1, a: $asb. A}

CodePudding user response:

For example I use this statement, then join the Agregation
ProjectionOperation ProjectionOperation=Aggregation. Project (new String [] {" a ", "b", "c", "asb. A"});
The last
I was meant to query $project {a: 1, b: 1, c: 1, asb. A: 1}
But the results will be mongoTemplate into $project {a: 1, b: 1, c: 1, a: $asb. A}

CodePudding user response:

For example: I use this statement, then join the Agregation
ProjectionOperation ProjectionOperation=Aggregation. Project (new String [] {" a ", "b", "c", "asb. A"});
The last
I was meant to query $project {a: 1, b: 1, c: 1, asb. A: 1}
But the results will be mongoTemplate into $project {a: 1, b: 1, c: 1, a: $asb. A}
  • Related