0
{
    $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

1 Answer 1

1

I found answer

Aggregation.project() .and("day_work").nested("timestamp","timestamp").and("view","view")...etc

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.