0

I am using free text search of mongo2.4 with pymongo. What I want is to get the number of documents having some text. In the mongo shell, increasing the limit is a good turnaround, but from python it gets very slow since all documents have to be sent. For indication, the query is ~50 times slower in pymongo compared to mongo shell.

I use a command similar to this:

>>>res=db.command('text','mytable',search='eden',limit=100000)
>>>numfound = res['stats']['nfound']

But as I said, since all documents are returned, it is really slow. Is there a command to specify that you don't need documents, just the stats?? What is the list of all available options??

thx, colin

colin
  • 81
  • 2
  • 7

1 Answers1

0

I couldn't find a server ticket for this feature - so please add a feature request to: jira.mongodb.org then you'll get updates and feedback from the core server developers.

You can project when doing a text query, so you can reduce the amount sent over the wire - but still sends some information eg:

db.mytable.runCommand( "text", { search: "eden", project: {_id: 0, b: 1}})
Ross
  • 17,861
  • 2
  • 55
  • 73