The following two criteria sets give me identical results using Lithium and MongoDB. Both are equally easy to read and write. Should I prefer one over the other for efficiency reasons, or is one just Lithium/MongoDB syntactic sugar for the other?
$criteria = array(
'fields' => array('_id', 'title', 'created', 'edited', 'username'),
'order' => {'edited' => 'ASC'},
'limit' => 3
);
And
$criteria = array(
'$orderby' => array('edited' => 'ASC'),
'fields' => array('_id', 'title', 'created', 'edited', 'username'),
'limit' => 3
);
Follow up question: I really struggled to figure out the right syntax to use for order
and $orderby
, and in general I find Lithium's code pretty hard to grok. Do you have any suggestions on how best to approach the codebase for better/faster understanding?
PS: I realise the follow up question might not really be StackOverflow style - but there are other posts on SO and elsewhere which hint at exactly this problem (e.g. Lithium apps that go beyond CRUD). Any input on this could be really valuable!