Larvel操作MongoDB(インライン配列の削除)
Larvel操作MongoDB(インライン配列の削除)
PHPのMongoDB駆動中国語ドキュメント
PHPのMongoDBドライバ公式ドキュメント
詳細は全部書いていませんが、勉強したいなら公式ドキュメントを読んでください.
通常の削除変更はmysql駆動操作と同じです
埋め込み配列を削除するには、まずMongoDBオペレータ:https://www.runoob.com/mongodb/mongodb-operators.htmlを知っておく必要があります.
PHPのMongoDB駆動中国語ドキュメント
PHPのMongoDBドライバ公式ドキュメント
詳細は全部書いていませんが、勉強したいなら公式ドキュメントを読んでください.
通常の削除変更はmysql駆動操作と同じです
$rs = DB::collection(' ')->insertGetId($param);
$rs = DB::collection(' ')->insert($param);
$rs = DB::collection(' ')->where(["_id"=>1])->delete();
$rs = DB::collection(' ')->where(["_id"=>1])->update(['name'=where(["_id"=>1])->get();
//
$results = DB::collection(' ')->paginate(10);
//
orderBy() ,
skip()
limit()
$rs = DB::collection(' ')->orderBy('age','asc')->skip(10))->limit(10)->get();
埋め込み配列を削除するには、まずMongoDBオペレータ:https://www.runoob.com/mongodb/mongodb-operators.htmlを知っておく必要があります.
// $addToSet
$rs = DB::collection('user_files_folder')->update(['$addToSet'=>['child'=>['name'=>' ']])
// $push
$rs = DB::collection('user_files_folder')->update(['$push'=>['child'=>['name'=>' ']])
$rs = DB::collection('user_files_folder')->update(['$pull'=>['child'=>['name'=>' ']])
// , where .
$set , ( )
. , $ ( ,$ , 0-9 )
DB::collection('stock')->where(['info.id'=>"118b110212"])->update([
$set'=>[
'info.$.id'=>"118b110jkjkjk"
]
]);