I just started using mongoDb as my backend for PHP.
I just use the find () query for one of my needs. I want only the first 100 results, but also want to get the final results. I am trying to do this.
$cursor = $this->dbReference->dbName->find($query); if($count != 0) { $cursor->skip($startIndex); $cursor->limit($count); } $totalCount = $cursor->count(); $entries = array(); while ($cursor->hasNext()) { $cursor->next(); $entry = $cursor->current(); array_push($entries , $entry); }
Now the problem is that T its search result contains exactly more than 50 thousand results. But I only get 100 at a time. I use $ cursor-> count () to get the total number of result lines available. on this line the error indicates that "Cursor timed out". Please can anyone suggest me what is the problem? or what is an alternative to search for the total number of search results.
Thanks in advance.
source share