Reputation: 165
{
$group : {...some query operation},
$project : {
_id:"$_id",
day_work : { // <-- I can't express this code in Java
timestamp:"$timestamp",
view : "$view",
pay : "$pay"
}
}
}
when sample data like this
{
... //some field and value,
timestamp:1411214521,
view : 3,
pay : 105
}
If above query does work, I expect this
{
... //some field and value,
day_work : {
"timestmp":1411214521,
view : 3,
pay : 105
}
}
I try like this
Aggregation.project("_id").andInclude("timestamp","view","pay") // <-- can't merge into day_work
Thanks for your help
Upvotes: 0
Views: 54
Reputation: 165
I found answer
Aggregation.project() .and("day_work").nested("timestamp","timestamp").and("view","view")...etc
Upvotes: 1