从mongo shell获取MongoBinData值

I save IP in mongo

$db = new MongoClient();

$db->selectCollection('test', 'test')->insert([
    'ip'=> new MongoBinData(inet_pton('127.0.0.1'), MongoBinData::BYTE_ARRAY),
]);

mongo shell

> db.test.find()
{ "_id" : ObjectId("54e1aeeb84663f3407000030"), "ip" : BinData(2,"BAAAAH8AAAE=") }

how to get initial data in mongo shell?

查看全部
duanfu1873
duanfu1873
2015/02/16 08:51
  • php
  • mongodb
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复