添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm getting this error trying to use $facet in aggregation pipeline:

{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=>{