<?php
$cmd = new \MongoDB\Driver\Command( [
'createIndexes => 'articles',
'indexes' => [
[
'key' => [ 'subject' => *'text'*, 'post' => *'text'* ],
*'weights' => [ 'subject' => 10, 'post' => 5 ]*
]
]
] );
$manager->executeCommand( 'demo', $cmd );
?>
<?php
require 'vendor/autoload.php';
$collection = (new MongoDB\Client)->demo->articles;
$collection->createIndex(
[ 'subject' => *'text'*, 'post' => *'text'* ],
[ *'weights' => [ 'subject' => 10, 'post' => 5 ]* ]
);
?>