我怎样才能得到结果的数量,相当于num_rows
(mysqli) in mongodb
?
如果我有
$db->$dbName->find(array("email" => $newemail, "password" => $newpass));
检查符合此标准的结果数量的最佳方法是什么?
在 mysqli 我会做类似的事情
$sql = "SELECT id FROM table WHERE email='%s' AND password='%s'";
$query = sprintf($sql, $newemail, $newpass);
$result = $conn->query($query);
$rows = $result->num_rows;