$dd=array('flag'=>0,'status'=>1);
$s=array( 'id' => -1);
$cursor = $collection->find($dd)->sort($s)->limit(10)->skip(0);
foreach ($cursor as $obj)
{
$username=$obj["username"];
}
id => -1 means sorting (desc) order in mongodb
in sql ---> order by id desc limit 0,10;
$s=array( 'id' => -1);
$cursor = $collection->find($dd)->sort($s)->limit(10)->skip(0);
foreach ($cursor as $obj)
{
$username=$obj["username"];
}
id => -1 means sorting (desc) order in mongodb
in sql ---> order by id desc limit 0,10;