首页 > 其他 > 详细

mongo操作 insert / findOne remove update 返回的值判断

时间:2017-02-15 19:28:51      阅读:781      评论:0      收藏:0      [点我收藏+]

插入操作 查看返回值

// $result = $mongoObj->insert($data);  //insert插入成功返回结果array(6) { ["connectionId"]=> int(36862) ["n"]=> int(0) ["syncMillis"]=> int(0) ["writtenTo"]=> NULL ["err"]=> NULL ["ok"]=> float(1) } 

1:更新成功后,返回array(7) { ["connectionId"]=> int(36864) ["updatedExisting"]=> bool(true) ["n"]=> int(1) ["syncMillis"]=> int(0) ["writtenTo"]=> NULL ["err"]=> NULL ["ok"]=> float(1) }

//2:失败后array(7) { ["connectionId"]=> int(36864) ["updatedExisting"]=> bool(false) ["n"]=> int(0) ["syncMillis"]=> int(0) ["writtenTo"]=> NULL ["err"]=> NULL ["ok"]=> float(1) }

//1:删除成功操作后,返回的结果 array(6) { ["connectionId"]=> int(36865) ["n"]=> int(1) ["syncMillis"]=> int(0) ["writtenTo"]=> NULL ["err"]=> NULL ["ok"]=> float(1) } 

//2:删除失败后,返回的结果     array(6) { ["connectionId"]=> int(36865) ["n"]=> int(0) ["syncMillis"]=> int(0) ["writtenTo"]=> NULL ["err"]=> NULL ["ok"]=> float(1) }  

//返回取出的值

//array(4) { ["_id"]=> object(MongoId)#7 (1) { ["$id"]=> string(24) "58a3ed5a6e0ef78c27000030" } ["name"]=> string(9) "zhangxiao" ["age"]=> string(2) "19" ["sex"]=> string(3) "nan" }


本文出自 “json在php中的使用” 博客,请务必保留此出处http://zhaozhangxiao.blog.51cto.com/10609825/1898059

mongo操作 insert / findOne remove update 返回的值判断

原文:http://zhaozhangxiao.blog.51cto.com/10609825/1898059

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!