当前位置:网站首页>Tp6 fast installation uses mongodb to add, delete, modify and check
Tp6 fast installation uses mongodb to add, delete, modify and check
2022-07-03 01:19:00 【Life goes on and battles go on】
Preface
MongoDB Is a document database in a non relational database .MongoDB It's for the rapid development of the Internet Web application And the designed database system . MongoDB The goal of our design is minimalism 、 flexible 、 As Web Part of the application stack . MongoDB The data model of is document oriented , The so-called document is similar to JSON Structure , Simple understanding MongoDB There are all kinds of things in this database JSON.
One 、 Basic concepts :
Example :pandas Is based on NumPy A tool of , The tool is created to solve data analysis tasksfile (document): Be similar to JS Objects in the , stay MongoDB The number of each item in It's all a document .
aggregate (collection): A collection is a set of documents , That is, a collection is used to store text Stall . The documents stored in the collection can be various , No lattice The formula demands .
Multiple documents make up a collection , Multiple collections make up a database
Use
1. stay config/database In file
'mongodb' => [
// Database type
'type' => 'mongo',
// Server address
'hostname' => '127.0.0.1',
// Database name
'database' => 'goods',
// user name
'username' => '',
// password
'password' => '',
// port
'hostport' => '27017',
// Database connection parameters
'params' => [],
// Database mode
'debug' => env('database.debug', true),
// Database deployment :0 Centralized ( Single server )1 Distributed ( Master slave server )
'deploy' => 0,
// Whether the reading and writing of data Office database are classified Master slave is effective
'rw_separate' => false,
// monitor sql
'trigger_sql' => true,
// After the separation of reading and writing , Number of servers
'master_num' => 1,
// Specify the slave server serial number
'slave_no' => '',
// Whether to strictly check whether the field exists
'fields_strict' => true,
// Whether it needs to be disconnected and reconnected
'break_reconnect' => false,
// Field cache path
'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR,
]Realization curd operation
add to
// Receiving parameters
$postData = $request->post();
$data = Db::connect('mongodb')->table('goods')->insert($postData);
dd($data)Inquire about
// call mongodb Query data
$data = Db::connect('mongodb')->table('goods')->select()->toArray();
dd($data);Conditional query
// Conditional query
$comment = Db::connect('mongo')->table('comments')->where('product_id',intval($product_id))->select()->toArray();
Delete
// Delete data
Db::connect('mongodb')->table('goods')->where('_id', $id)->delete();边栏推荐
- [shutter] image component (cached_network_image network image caching plug-in)
- Explain the basic concepts and five attributes of RDD in detail
- 删除有序链表中重复的元素-II
- JS inheritance and prototype chain
- leetcode 2097 — 合法重新排列数对
- leetcode:701. 二叉搜索树中的插入操作【bst的插入】
- On Fibonacci sequence
- MySQL foundation 06 DDL
- 不登陆或者登录解决oracle数据库账号被锁定。
- 【FH-GFSK】FH-GFSK信号分析与盲解调研究
猜你喜欢

What is needed to develop a domestic arm intelligent edge computing gateway

Database SQL language 02 connection query

【无标题】

FPGA - 7系列 FPGA内部结构之Clocking -04- 多区域时钟

【FPGA教程案例6】基于vivado核的双口RAM设计与实现

Linear programming of mathematical modeling (including Matlab code)

excel IF公式判断两列是否相同

Basic concept and implementation of overcoming hash

Trois tâches principales: asynchrone, courrier et timing
![leetcode:701. Insertion in binary search tree [BST insertion]](/img/bc/1dda73198488eb81b49be2c1dff6c2.png)
leetcode:701. Insertion in binary search tree [BST insertion]
随机推荐
FPGA - 7 Series FPGA internal structure clocking -04- multi area clock
2022 Jiangxi Provincial Safety Officer B certificate reexamination examination and Jiangxi Provincial Safety Officer B certificate simulation examination question bank
按键精灵打怪学习-多线程后台坐标识别
MongoDB系列之MongoDB常用命令
MySQL foundation 06 DDL
2022.2.14 resumption
机器学习术语
MySQL --- 数据库查询 - 条件查询
Trois tâches principales: asynchrone, courrier et timing
【FPGA教程案例6】基于vivado核的双口RAM设计与实现
Assets, vulnerabilities, threats and events of the four elements of safe operation
JS inheritance and prototype chain
R language uses coin package to apply permutation tests to independence problems (permutation tests, whether response variables are independent of groups, are two numerical variables independent, and
MySQL
[shutter] image component (configure local GIF image resources | load placeholder with local resources)
Cut point of undirected graph
Create your first Kivy program Hello word (tutorial includes source code)
Mongodb common commands of mongodb series
465. DFS backtracking of optimal bill balance
What is needed to develop a domestic arm intelligent edge computing gateway