当前位置:网站首页>Mongo shell interactive command window
Mongo shell interactive command window
2022-07-29 04:27:00 【Test brother Han】
mongo shell yes MongoDB Interactive command window . have access to mongo shell operation MongoDB, for example : Yes MongoDB Carry on all kinds of CRUD operation . MongoDB It comes with you when you install it mongo shell, No need to install it separately .
Tips : The following chapters , The main use of mongo shell Command and api Introduce MongoDB Various operations , If you use programming language or visual MongoDB Compass operation MongoDB, Their grammar is similar , So just master mongo shell The grammar of , You know how to use other tools .
start-up mongo Shell And connect to MongoDB
Connect local MongoDB Server
Direct input mongo command , You can enter Mongo Shell
mongo
Use the default address to connect MongoDB Server
Tips : If the prompt cannot be found mongo command , That means installation MongoDB When , No will MongoDB Of bin Directory added to PATH environment variable , For details, please refer to the previous installation chapter .
If successful, the following information will be output :
MongoDB shell version v4.4.5
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("b11bfc3e-e70c-42b1-9bfc-5d9218f2d232") }
MongoDB server version: 4.4.5
>
In the interactive window , Enter the operation command .
Get into docker In container mongo shell
If , We use docker install MongoDB The name of the container is mongo, Then use the following command to directly enter mongo shell
docker exec -it mongo mongo
Connect remote MongoDB Server
mongo --username root --password --host mongodb0.examples.com --port 28015
Parameter description :
- —username Set up MongoDB Account No root
- —password You will be prompted to enter the password
- —host Appoint mongodb Server address
- —port Appoint MongoDB Server Port number
mongo shell Basic command
Displays the name of the database currently in use
db
Switch to another database
Format :
use Database name
use tizi365
mongo shell Operation example
// Switch database
use myNewDatabase
// Insert a piece of data
db.myCollection.insertOne( { x: 1 } );
// Inquire about inventory Gather all the data
db.inventory.find( {} )
// Inquire about inventory aggregate ,status = "D" Document data
db.inventory.find( { status: "D" } )
added mongo Shell Operation command , It will be introduced in the following chapters .
sign out mongo shell
边栏推荐
- Shielding ODBC load balancing mode in gbase 8A special scenarios?
- Compilation and linking
- Redux quick start
- Niuke IOI weekly 27 popularity group
- Mpc5744p introduction and opensda firmware update
- Record the Niua packaging deployment project
- 14. Haproxy+kept load balancing and high availability
- Integration of Nan causes in pytorch training model
- Deep learning training strategy -- warming up the learning rate
- 不会就坚持61天吧 最短的单词编码
猜你喜欢

【Express连接MySQL数据库】

Not for 61 days. The shortest word code

通过js来实现一元二次方程的效果,输入a,b,c系数后可计算出x1和x2的值

Machine vision Series 1: Visual Studio 2019 dynamic link library DLL establishment

使用容器部署Jenkins

Redux quick start

Installation and use of stm32cubemx (5.3.0)

不会就坚持64天吧 查找插入位置

redux快速上手

Basic operation of queue
随机推荐
Machine vision series 3:vs2019 opencv environment configuration
Mongo Shell交互式命令窗口
9. Delay queue
Deep learning training strategy -- warming up the learning rate
MySQL gets the maximum value record by field grouping
Not for 63 days. The biggest XOR
[material delivery UAV] record (ROS + Px4 + yolov5 + esp8266 + steering gear)
不会就坚持71天吧 链表排序
Sign the college entrance examination
pyscript无法引入包
Introduction and examples of parameters in Jenkins parametric construction
Laya中的A星寻路
Differences and principles of bio, NiO and AIO
openFeign异步调用问题
Use of torch.optim optimizer in pytorch
Database SQL statement realizes function query of data decomposition
C语言力扣第61题之旋转链表。双端队列与构造循环链表
Realize the effect of univariate quadratic equation through JS. Enter the coefficients of a, B and C to calculate the values of X1 and x2
Flutter实战-请求封装(二)之dio
Machine vision Series 1: Visual Studio 2019 dynamic link library DLL establishment