I've written the following query (that may or may not be efficient, I'm still a newbie):
$collection = $this->dm->getConnection()->selectCollection('db_name', 'collection_name');
$query = array('array_name' => new \MongoId(id));
$cursor = $collection->find($query)->limit(9)->sort('r', 'desc');
I'm trying to sort by an r value that looks like this in the document:
"r": 0.58325652219355106354
but it isn't actually sorting it by that r-value. What am I doing wrong?
Pretty sure sort takes an array argument. Try
I looked it up... http://apigen.juzna.cz/doc/doctrine/mongodb/source-class-Doctrine.MongoDB.Cursor.html#564-585