Mongo allows you to specify a 1 or -1 order for indexes. Is this possible with laravel-mongodb?
/**
* Simulate order by clause on the collection.
*
* @param string $key
* @param string $direction
* @return $this
*/
public function orderBy($key, $direction = 'asc')
{
$descending = strtolower($direction) == 'desc';
return $this->sortBy($key, SORT_REGULAR, $descending);
}
Thanks @cnhttpd. I'm familiar with the orderBy method, but that was not my question.
My question was dealing with Blueprint and creating an index on a collection.
Just look at the source! Taking a peek at the Blueprint::index method, it would seem you can just do $collection->index(['name' => -1]);
Most helpful comment
Just look at the source! Taking a peek at the Blueprint::index method, it would seem you can just do
$collection->index(['name' => -1]);