增
$user = array(''name'' => ''caleng'', ''email'' => ''admin@admin.com'');
$collection->insert($user);
//修改
$newdata = array(''$set'' => array("email" => "test@test.com"));
$collection->update(array("name" => "caleng"), $newdata);
//删除
$collection->remove(array(''name''=>''caleng''), array("justOne" => true));
//查找
$cursor = $collection->find();
var_dump($cursor);
//查找一条
$user = $collection->findOne(array(''name'' => ''caleng''), array(''email''));
var_dump($user);
?>
4、关闭连接
复制代码 代码如下:
<?php
$conn->close();
?>