-
Notifications
You must be signed in to change notification settings - Fork 202
Open
Labels
questionFurther information is requestedFurther information is requested
Description
script like "const avgSendReceiveDiff = db.chatGptMessage.aggregate([
{
$project: {
created_by: 1,
timeDifference: { $subtract: ["$receive_time", "$send_time"] }
}
},
{
$group: {
_id: "$created_by",
avgTimeDifference: { $avg: "$timeDifference" }
}
}
])"
When i use context.eval("js",script)
I expected the "$subtract: ["$receive_time", "$send_time"]" stay unchanged and mongo java driver can parse, but when i extract the string, it was serialize into " $subtract: Array(2)", and mongodb can not parse.
How can i fix this?
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested