标签:val https driver ups 使用 文档 一个 bms x86_64
操作
|
格式
|
范例
|
RDBMS中的类似语句
|
等于
|
{<key>:<value>}
|
db.col.find({"by":"菜鸟教程"}).pretty()
|
where by = ‘菜鸟教程‘
|
小于
|
{<key>:{$lt:<value>}}
|
db.col.find({"likes":{$lt:50}}).pretty()
|
where likes < 50
|
小于或等于
|
{<key>:{$lte:<value>}}
|
db.col.find({"likes":{$lte:50}}).pretty()
|
where likes <= 50
|
大于
|
{<key>:{$gt:<value>}}
|
db.col.find({"likes":{$gt:50}}).pretty()
|
where likes > 50
|
大于或等于
|
{<key>:{$gte:<value>}}
|
db.col.find({"likes":{$gte:50}}).pretty()
|
where likes >= 50
|
不等于
|
{<key>:{$ne:<value>}}
|
db.col.find({"likes":{$ne:50}}).pretty()
|
where likes != 50
|
<?php
$manager = new MongoDB\Driver\Manager("mongodb://127.0.0.1:27017");
//print_r($manager);
//查询
/*
//查询条件
$filter = ["name"=>‘shuaige‘];
$query = new MongoDB\Driver\Query($filter);
$cursor = $manager->executeQuery(‘yyy.user‘, $query);
foreach ($cursor as $document) {
print_r($document);
}
*/
//插入数据
/*
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->insert([‘name‘=>‘zzz‘,‘age‘=>18]);
$bulk->insert([‘name‘=>‘zsy‘,‘age‘=>17]);
$res = $manager->executeBulkWrite(‘yyy.user‘, $bulk);
print_r($res);
*/
//更新
/*
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->update([‘name‘=>‘zzz‘],[‘$set‘=>[‘girl‘=>‘LYF‘]]);
$writeConcern = new MongoDB\Driver\WriteConcern(MongoDB\Driver\WriteConcern::MAJORITY, 1000);
$result = $manager->executeBulkWrite(‘yyy.user‘, $bulk, $writeConcern);
print_r($result);
*/
//删除
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->delete([‘name‘=>‘shuaige‘]);
$writeConcern = new MongoDB\Driver\WriteConcern(MongoDB\Driver\WriteConcern::MAJORITY, 1000);
$result = $manager->executeBulkWrite(‘yyy.user‘, $bulk, $writeConcern);
print_r($result);
Mangodb的服务启动:
./bin/mongod --dbpath=/usr/local/mongodb/data/ --logpath=/usr/local/mongodb/logs/log --bind_ip=0.0.0.0 --fork
标签:val https driver ups 使用 文档 一个 bms x86_64
原文地址:https://www.cnblogs.com/yujianni/p/9200978.html