php mongodb排序、查询
我正在尝试使用我设置的键值进行查询 下面是数据库中的内容php mongodb排序、查询,php,mongodb,Php,Mongodb,我正在尝试使用我设置的键值进行查询 下面是数据库中的内容 { "_id": { "$oid": "53166de3456a48980b00001f" }, "active": 1, "approved": 1, "date": "2014-03-04 16:20:51", "description": "flip blocks to form rows", "developer": "22", "iframe": "515", "image": "https://www.filep
{
"_id": {
"$oid": "53166de3456a48980b00001f"
},
"active": 1,
"approved": 1,
"date": "2014-03-04 16:20:51",
"description": "flip blocks to form rows",
"developer": "22",
"iframe": "515",
"image": "https://www.filepicker.io/api/file/f3eNFrgJRwqNprn7VLR0",
"iosStore": "",
"key": 1393978851,
"leader": 0,
"leaderName": "Default",
"leaderScore": 0,
"platform": "html5",
"plays": 0,
"playStore": "",
"pot": 0,
"rules": "flip blocks to form rows",
"title": "tet_blocks",
"type": 1,
"web": "gamerholic.com/games/tetris/index.html"
}
我的问题是:
$key=1393978851
//tried it both with and without the new mongoID
$criteria = array(
'key'=> new MongoId($key),
);
$doc = $collectionBonsai->findOne($criteria);
$platform = $doc['platform'];
平台返回空,doc返回空,当密钥明显位于数据库中并且它是数据库中唯一一个具有该密钥的密钥时。密钥是一个时间戳。
按_id查找也会返回空,
如果我确实按用户查找,它会将其列为文档之一
我尝试了很多其他的变化和类似的东西
回应是
阿拉
我将其更改为int$key,现在可以工作了代码实际上应该为无效对象引发异常这是什么驱动程序版本?