Example #1
0
 public function testWhereText()
 {
     $dbVersion = $this->collection->getDatabase()->getClient()->getDbVersion();
     if (version_compare($dbVersion, '2.6', '<=')) {
         return;
     }
     $this->collection->ensureFulltextIndex(array('subject', 'body'), array('subject' => 2, 'body' => 1));
     $this->collection->batchInsert(array(array('subject' => 'big brown dog', 'body' => 'walking on street'), array('subject' => 'little pony', 'body' => 'flying among rainbows')));
     $documents = $this->collection->find()->whereText('pony')->findAll();
     $this->assertEquals(1, count($documents));
     $document = current($documents);
     $this->assertEquals('little pony', $document->subject);
 }