Remon Nashid
Remon Nashid

Reputation: 120

Equivalent to mongo shell db.collection.runCommand() in Node.js

I'd like to use full text search available in MongoDB 2.4. Text search is available through runCommand function e.g. db.collection.runCommand( "text", { search: "keywords"}). So, I'm wondering whether there is an equivalent to runCommand() function in mongojs or node-mongodb-native modules.

I know the question has been touched before but was never answered sufficiently. Thanks in advance.

Upvotes: 1

Views: 2802

Answers (2)

user3707805
user3707805

Reputation: 105

I found that as an equivalent:

collection.find({ $text: { $search : "your search words" }})
  .toArray(function(err,results) {
    // ..callback stuff..
});

Upvotes: 1

Remon Nashid
Remon Nashid

Reputation: 120

runCommand support has been added! https://github.com/gett/mongojs/issues/62

Upvotes: 0

Related Questions