I'm having problems trying to construct a query that should
changelog.histories.created
field from the object that contains a Completed
changelog.histories.items.toString
value5a423f48d3983274668097f3
and 5a423f48d3983274668097f3
)Below is my current aggregate query pipeline
"pipeline" => [
[
'$match' => [
'fields.project.key' => 'DW',
'fields.issuetype.name' => [
'$in' => ['Bug', 'Perceived Defect']
],
'changelog.histories.items.field' => 'status',
'changelog.histories.items.toString' => 'Completed'
]
],
[
'$project' => [
'fields.issuetype.name' => 1,
'key' => 1,
'fields.summary' => 1,
'fields.reporter.displayName' => 1,
'fields.status.name' => 1,
'changelog.histories.created' => 1,
]
],
[
'$group' => [
"_id" => 0,
'count' => [
'$sum' => 1
]
],
]
]
]
Below is a document with two example objects
[
{
{
"_id": {
"$oid": "5a423f48d3983274668097f3"
},
"id": "59817",
"key": "DW-15450",
"changelog": {
"histories": [
{
"id": "449018",
"created": "2017-12-13T11:11:26.406+0000",
"items": [
{
"field": "status",
"toString": "Released"
}
]
},
{
"id": "448697",
"created": "2017-12-08T09:54:41.822+0000",
"items": [
{
"field": "resolution",
"toString": "Fixed"
},
{
"field": "status",
"toString": "Completed"
}
]
}
]
},
"fields": {
"issuetype": {
"id": "1",
"name": "Bug"
}
}
},
{
"_id": {
"$oid": "5a423f48d3983274668097f3"
},
"id": "59818",
"key": "DW-15451",
"changelog": {
"histories": [
{
"id": "449019",
"created": "2017-12-13T11:11:26.406+0000",
"items": [
{
"field": "status",
"toString": "Released"
}
]
},
{
"id": "448697",
"created": "2017-12-08T09:54:41.822+0000",
"items": [
{
"field": "resolution",
"toString": "Fixed"
},
{
"field": "status",
"toString": "Completed"
}
]
}
]
},
"fields": {
"issuetype": {
"id": "1",
"name": "Bug"
}
}
}
]
}
Currently my query returns the following
[
{
"result": [
{
"_id": 0,
"count": 2
}
],
"ok": 1
}
]
So the ideal result of the query would look something like.
[
{
"result": [
{
"key": "DW-10518",
"fields": {
"status": {
"name": "Completed"
},
"reporter": {
"displayName": "..."
},
"issuetype": {
"name": "Bug"
}
},
"changelog": {
"histories": {
"created": {
2017-12-13T11:11:26.406+0000
}
}
}
},
{
"key": "DW-10519",
"fields": {
"status": {
"name": "Completed"
},
"reporter": {
"displayName": "..."
},
"issuetype": {
"name": "Bug"
}
},
"changelog": {
"histories": {
"created": {
2017-12-13T11:11:26.406+0000
}
}
}
},
{
"_id": 0,
"count": 2
}
],
"ok": 1
}
]
How to prevent a token created with OAuth 2.0 from expiring?
I'm having troubles displaying a value in an input fieldI did this in the past, and I haven't got a clue where my code goes wrong
This question already has an answer here:
Does someone know where you use a multiton class for (and an example)I got the question to make something in PHP using a multiton class