db.checkins.createIndex( { 'clinked_by.slug': 1 } );
<?php
$cmd = new \MongoDB\Driver\Command( [
'createIndexes => 'checkins',
'indexes' => [
[ *'key'* => [ 'user_slug' => 1, 'friend_slug => 1 ], *'unique'* => true ],
]
] );
$manager->executeCommand( 'dramio', $cmd );
<?php
require 'vendor/autoload.php';
$collection = (new MongoDB\Client)->dramio->user;
$collection->createIndex(
[ 'validation_code' => 1 ],
*[ 'sparse' => true ]*
);