runCommand equivalent for nodejs-native-mongodb

前端 未结 1 1004
生来不讨喜
生来不讨喜 2020-12-16 05:06

I\'m trying to utilize MongoDB 2.4 experimental text search feature from within nodejs. The only problem is, native nodejs mongo drivers don\'t seem to support collection-le

相关标签:
1条回答
  • 2020-12-16 06:06

    I managed to get it working through a combination of Asya Kamsky's comment, by utilizing

    this.db.command({text:"collection" , search: "phrase" }).
    

    The problem was it isn't returned like a standard result so a toArray() call was failing. Instead, I put the callback directly inside:

    this.db.command({text:"collection" , search: "phrase" }, function(err, cb){ 
    
    0 讨论(0)
提交回复
热议问题