当前位置:网站首页>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
边栏推荐
- Whether the modification of import and export values by ES6 and commonjs affects the original module
- Dabao and Erbao
- RMAN do not mark expired backups
- SQL time fuzzy query datediff() function
- Understand the Internet giant [the war between China and Taiwan] and the development thinking of China and Taiwan
- [common commands]
- Why is it necessary to scale the attention before softmax (why divide by the square root of d_k)
- Not for 60 days, magical dictionary
- Integration of Nan causes in pytorch training model
- HC06 HC05 BT
猜你喜欢
随机推荐
C language force buckle question 61 of the rotating list. Double ended queue and construction of circular linked list
C语言:typedef知识点总结
Differences and principles of bio, NiO and AIO
Fuzzy query of SQL
Dabao and Erbao
Labelme cannot open the picture
mpc5744p简介与OpenSDA固件更新
Methods of using multiple deformations on an element
Can you really write restful API?
Deep learning training strategy -- warming up the learning rate
C language: summary of consortium knowledge points
Why is it necessary to scale the attention before softmax (why divide by the square root of d_k)
顺序表和链表
用 ZEGO Avatar 做一个虚拟人|虚拟主播直播解决方案
It won't last for 70 days. The k-largest number in the array
不会就坚持71天吧 链表排序
Whether the modification of import and export values by ES6 and commonjs affects the original module
[k210 stepping pit] pytorch model is converted to kmodel and used on dock. (ultimately not achieved)
i++与++i详解
pyscript无法引入包









