0

I used morphia for MongoDB aggregation to data. but I need to round my aggregation pipeline projection data. my code is

 aggregationPipeline.project(
            Projection.projection("_id").suppress(),
            Projection.projection("query", "_id.query"),
            Projection.projection("clicks", "clicks"),
            Projection.projection("impressions", "impressions"),
            Projection.projection("ctr",  "ctr"),
            Projection.projection("position", "position")
);

My Output is

{
        "query": "google",          
        "clicks": 5,
        "impressions": 16,
        "ctr": 0.19375,
        "position": 3.39375,          
},

but i expect that

{
        "query": "google",          
        "clicks": 5,
        "impressions": 16,
        "ctr": 0.19,
        "position": 3.39,          
},

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.