Hi, i try use Mongo. Why result is not wrapped into array? I want get current record for login. Thanks.
Structure:
{
"_id" : ObjectId("540822d55d34c4087a320064"),
"user" : {
"login" : "one",
"password" : "$2y$10$RB2PvyRWxD7kdZcYpb8BGO6E/2ftbAEwnJ/28TBWUaDmX.iesPqY2",
"role" : "user"
}
}
Code:
$cursor = LoginModel::find(array(
"user.login" => $login
));
foreach($cursor as $doc){ // query
foreach($doc as $s){
echo "<pre>";
var_dump($s);
echo "</pre>";
}
}
Result:
object(MongoId)#84 (1) {
["$id"]=>
string(24) "540822d55d34c4087a320064"
}
array(3) {
["login"]=>
string(3) "one"
["password"]=>
string(60) "$2y$10$RB2PvyRWxD7kdZcYpb8BGO6E/2ftbAEwnJ/28TBWUaDmX.iesPqY2"
["role"]=>
string(4) "user"
}