[mongodb 3.0.0-rc0] fulltext search "MongoError: must have $meta projection for all $meta sort keys"

55 views
Skip to first unread message

Long Cao

unread,
Dec 16, 2017, 11:05:04 AM12/16/17
to node-mongodb-native
var query = {
      $text: { $search: 'abc', $caseSensitive : false}
    };

const result = await collection.find(query,{score: { $meta: "textScore" }}).sort( { score: { $meta: "textScore" } }).toArray();

This full text search query is working fine with mongodb 2.2.33, but it does not work when we upgrade to mongodb 3.0.0-rc0.

When I execute that query with mongodb driver 3.0.0-rc0, I got the Error: MongoError: must have $meta projection for all $meta sort keys

If I remove "sort( { score: { $meta: "textScore" } })" ---> mongodb driver 3.0.0-rc0 is working fine.

Can anyone help me on this?
Reply all
Reply to author
Forward
0 new messages