{message: "aggregation stage "$facet" is not supported", name: "e", errorCode: 5, errorCodeName: "InvalidParameter", stack: "e: aggregation stage "$facet" is not supported↵ …m/stitch-sdks/js/bundles/4.8.0/stitch.js:1:203137"}
Are you gonna support $facet in the future or is my code incorrect?
Im trying to get a count of all documents after I limited them.
stitchApp.auth.loginWithCredential(new AnonymousCredential()).then((user) => {
db.collection('products').aggregate([
{ $facet: {
"products": [
{ $match: query },
$group: {
_id: "$groupid",
id: { $last: "$_id" },
images: { $last: "$images" },
description: { $last: "$description" },
barcode: { $min: "$barcode" },
category: { $last: "$category" },
subcategory: { $last: "$subcategory" },
discount: { $last: "$discount" },
{ $sort: { '_id': 1 } },
{ $limit: 30 },
"totalCount": [
{ $match: query },
$group: {
_id: "$groupid",
count: { $sum: 1 }
]).toArray().then(result=>{