[
{"_id": ObjectId("5abb4f9ca7e2c54c757b3e48"),
"amount": 8400,
"buyerEmail": "otzYzwMh24edWk8NxSJOqCSZREe0",
"from": "weixin",
"orderDate": datetime.datetime(2018, 3, 28, 8, 17, 28, 940000),
"orderid": "2018032816173212079",
"real": 8400,
"rechargeDate": datetime.datetime(2018, 3, 28, 8, 17, 41, 877000),
"status": 1,
"tradeNo": "4200000099201803287230332578",
"uid": ObjectId("5abb36051a62067bf7e30178")
},
{"_id": ObjectId("5b6699f6df03ec3294d7c0a4"),
"amount": 100,
"buyerEmail": "otzYzwC3YwRdu7QrWLXqS3VRJybI",
"from": "weixin",
"orderDate": datetime.datetime(2018, 8, 5, 6, 32, 21, 442000),
"orderid": "2018080514322245193",
"real": 100,
"rechargeDate": datetime.datetime(2018, 8, 5, 6, 33, 0, 381000),
"status": 1,
"tradeNo": "4200000148201808052403940202",
"uid": ObjectId("5a5738411a62061972e128cb")
},
.....
]
how to integrate the same uid and display only the elements of uid real from rechargeDate?
$group similar to mongodb aggregation
ideal result:
[
{"uid":xxxxxxxxxxxxxxxx:
[
{
"real":xxx,
"from":xxx,
"recharge":xxx,
},
{
"real":xxx,
"from":xxx,
"recharge":xxx,
},
{
"real":xxx,
"from":xxx,
"recharge":xxx,
},
]
},
{"uid":xxxxxxxxxxxxxxxx:
[
{
"real":xxx,
"from":xxx,
"recharge":xxx,
},
{
"real":xxx,
"from":xxx,
"recharge":xxx,
},
{
"real":xxx,
"from":xxx,
"recharge":xxx,
},
]
},
...
]