Unrecognized expression '$last' in node express project

Unrecognized expression '$last' in node express project i'm getting this error this $last in $project project section in activity section activity: { "$last": "$activity" }

let newsFeed = await RecentActivity.aggregate([
            { $unwind: '$activity' },
            {
                $match: {
                    $and: [
                        { "activity_type": { $in: showActivityIds } },
                        { "activity_type": { $nin: activityIds } },
                        { "activity.activity_type": { $nin: notInSubActivity } },
                        { "activity.hide_by_admin" : 0}
                    ]
                }
            },
            { $match: { "activity.visible_to": 0 } },

            { $lookup: { from: "users", localField: "activity.user", foreignField: "_id", as: "activity.user" } },
            { $unwind: { path: "$activity.user", preserveNullAndEmptyArrays: true } },

            { $lookup: { from: "properties", localField: "activity.property", foreignField: "_id", as: "activity.property" } },
            { $unwind: { path: "$activity.property", preserveNullAndEmptyArrays: true } },

            { $lookup: { from: "users", localField: "activity.target_user", foreignField: "_id", as: "activity.target_user" } },
            { $unwind: { path: "$activity.target_user", preserveNullAndEmptyArrays: true } },

            { $lookup: { from: "users", localField: "activity.original_user", foreignField: "_id", as: "activity.original_user" } },
            { $unwind: { path: "$activity.original_user", preserveNullAndEmptyArrays: true } },

            { $lookup: { from: "reviews", localField: "activity.review", foreignField: "_id", as: "activity.review" } },
            { $unwind: { path: "$activity.review", preserveNullAndEmptyArrays: true } },

            { $lookup: { from: "users", localField: "activity.review.user", foreignField: "_id", as: "activity.review.user" } },
            { $unwind: { path: "$activity.review.user", preserveNullAndEmptyArrays: true } },

            { $lookup: { from: "productorders", localField: "activity.productreview", foreignField: "_id", as: "activity.productreview" } },
            { $unwind: { path: "$activity.productreview", preserveNullAndEmptyArrays: true } },

            { $lookup: { from: "users", localField: "activity.productreview.user", foreignField: "_id", as: "activity.productreview.user" } },
            { $unwind: { path: "$activity.productreview.user", preserveNullAndEmptyArrays: true } },

            { $lookup: { from: "products", localField: "product", foreignField: "_id", as: "product" } },
            { $unwind: { path: "$product", preserveNullAndEmptyArrays: true } },

            { $lookup: { from: "properties", localField: "property", foreignField: "_id", as: "property" } },
            { $unwind: { path: "$property", preserveNullAndEmptyArrays: true } },

            { $lookup: { from: "posts", localField: "post", foreignField: "_id", as: "post" } },
            { $unwind: { path: "$post", preserveNullAndEmptyArrays: true } },

            { $lookup: { from: "sharesummaries", localField: "activity.post", foreignField: "post", as: "sharesummary" } },
            { $unwind: { path: "$sharesummary", preserveNullAndEmptyArrays: true } },

            { $lookup: { from: "users", localField: "post.user", foreignField: "_id", as: "post.user" } },
            { $unwind: { path: "$post.user", preserveNullAndEmptyArrays: true } },

            {
                $group: {
                    _id: "$_id",
                    activity_type: { "$first": "$activity_type" },
                    feeling: { "$first": "$feeling" },
                    created_date: { "$first": "$created_date" },
                    updated_date: { "$max": "$updated_date" },
                    activity_count: { "$first": "$activity_count" },
                    activity_tipped_count: { "$first": "$activity_tipped_count" },
                    activity_upvote_count: { "$first": "$activity_upvote_count" },
                    activity_comment_count: { "$first": "$activity_comment_count" },
                    activity: { $push: "$activity" },
                    product: { "$first": "$product" },
                    property: { "$first": "$property" },
                    shared_post: { "$first": "$sharesummary" },
                    post: { "$first": "$post" },
                    user: { "$first": "$post.user" },
                }
            },
            {
                $project: {
                    _id: 1,
                    updated_date: 1,
                    feeling: 1,
                    created_date: 1,
                    activity_type: 1,
                    activityCount: { "$size": "$activity" },
                    activity_count: 1,
                    activity_tipped_count: 1,
                    activity_upvote_count: 1,
                    activity_comment_count: 1,
                    activity: { "$last": "$activity" },
                    product: 1,
                    property: 1,
                    shared_post: 1,
                    post: 1,
                    user: 1,
                    rss_delete : 1
                }
            },
            { $sort: { "updated_date": -1 } },
            { $facet: facetquery },

        ]).exec();

I'm stuck here thanks in advance

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum