Maybe I'm doing something wrong, I'm going to start using your great and simple class to perform querying in my webapp.
To retrieve a list of users I'm doing this:
$users = new User();
$users = $users->search();
$list = array();
foreach($users as $u)
array_push($list, $u->toJSON());
$res->body(json_encode($list, JSON_UNESCAPED_SLASHES ));
Is there a better way to achieve this?
Edit:
I'm doing the foreach sillness to avoid the even sillier _id:{$id:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"} in my results
Maybe I'm doing something wrong, I'm going to start using your great and simple class to perform querying in my webapp.
To retrieve a list of users I'm doing this:
Is there a better way to achieve this?
Edit:
I'm doing the foreach sillness to avoid the even sillier _id:{$id:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"} in my results