I want to perform full text search on my collection. Since i am using mongo 2.4 I would like to do it with mongodb's text command
The way to do it in mongo's console is (as per mongo's official docs.)
db.collection.runCommand( "text", { search: <string> })
It returns expected results.
Now, I want to achieve same in ruby/rails. I am using mongo gem version 1.8.4
As per their change log/history there is a support for new MongoDB 2.4 index types
But how can i run the text command on a collection with ruby.
I went through this blog post. But it did'nt help
Update:
I tried,
command = BSON::OrderedHash.new
command['find'] = collection
command['text'] = {'search' => 'string'}
result = @db.command(command)
But it gives
Database command 'find' failed: (ok: '0.0'; errmsg: 'no such cmd: find'; bad cmd: '{"find"=>"project", "text"=>{"search"=>"string"}}').
Update 2:
Similar exists for php. I am looking ruby's equivalent for the same.