nickzuck_007 icon

Get test series from test id

nickzuck_007 | PRO | 03/18/19 06:14:02 AM UTC | 0 ⭐ | 311 👁️ | Never ⏰ | []
JSON |

880 B

|

None

|

0 👍

/

0 👎

db.products.aggregate([
    {$match : {"items.id": ObjectId("5880b8c1e9f131060a4a4aa6"), "type": "Test Pack"}},
    {$unwind : "$items"}, 
    {
        $lookup : {
            from : "products", 
            localField: "_id",
            foreignField: "items.id",
            as : "test_series"
        }
    }, 
    {$unwind: "$test_series"},
    {$group : {
            _id : "$test_series._id", 
            "title": {$first: "$test_series.title"}, 
            "series_items": {$first: "$test_series.items"}, 
            "pack_items": {$push: "$items"}, 
            "releaseDate": {$first: "$test_series.releaseDate"},
            "availTill" : {$first: "$test_series.availTill"},
            "stage" : {$first: "$test_series.stage"}, 
            "stage" : {$first: "$test_series.stage"}, 
            "isHidden" : {$first: "$test_series.isHidden"}
        }
    }
])

Comments