MongoDB Facet Error pipeline requires text score metadata, but there is no text score available
问题 I created a mongodb faceted pipeline that the following is a subset of: db.books.aggregate( [ { $facet: { "categories": [ { $match: { $text: { $search: "Pattern" } } }, { $group: { _id: "$Category", count: { $sum: 1 } } }, { $sort: { "count": -1 } }, { $project: { "score": { "$meta": "textScore"}, "Category": "$_id", "_id": 0, "count": 1 } }, { $limit: 10 } ] } } ]) Two other output fields exist in the pipeline aside from category but resemble the structure outlined in the pipeline above.