深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上鸿蒙开发知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新
- MongoDB自带Javascript Shell, 可在Shell中使用命令行与MongoDB实列交互
- Mongo Shell 由Mozilla官方提供的JavaScript内核解释器,内部使用SpiderMonkey
- SpiderMonkey对ECMA Script标准兼容性非常好,支持ES 6(ECMA Script 6)
Mongo Shell启动
Mongo Shell 参数如下
[root@localhost mongodb]# mongo --help
MongoDB shell version v4.4.14
usage: mongo [options] [db address] [file names (ending in .js)]
db address can be:
foo foo database on local machine
192.168.0.5/foo foo database on 192.168.0.5 machine
192.168.0.5:9999/foo foo database on 192.168.0.5 machine on port 9999
mongodb://192.168.0.5:9999/foo connection string URI can also be used
Options:
--ipv6 enable IPv6 support (disabled by
default)
--host arg server to connect to
--port arg port to connect to
-h [ --help ] show this usage information
--version show version information
--verbose increase verbosity
--shell run the shell after executing files
--nodb don't connect to mongod on startup - no
'db address' arg expected
--norc will not run the ".mongorc.js" file on
start up
--quiet be less chatty
--eval arg evaluate javascript
--disableJavaScriptJIT disable the Javascript Just In Time
compiler
--enableJavaScriptJIT enable the Javascript Just In Time
compiler
--disableJavaScriptProtection allow automatic JavaScript function
marshalling
--retryWrites automatically retry write operations
upon transient network errors
--disableImplicitSessions do not automatically create and use
implicit sessions
--jsHeapLimitMB arg set the js scope's heap size limit
--idleSessionTimeout arg (=0) Terminate the Shell session if it's been
idle for this many seconds
FLE AWS Options:
--awsAccessKeyId arg AWS Access Key for FLE Amazon KMS
--awsSecretAccessKey arg AWS Secret Key for FLE Amazon KMS
--awsSessionToken arg Optional AWS Session Token ID
--keyVaultNamespace arg database.collection to store encrypted
FLE parameters
--kmsURL arg Test parameter to override the URL for
KMS
AWS IAM Options:
--awsIamSessionToken arg AWS Session Token for temporary
credentials
TLS Options:
--tls use TLS for all connections
--tlsCertificateKeyFile arg PEM certificate/key file for TLS
--tlsCertificateKeyFilePassword arg Password for key in PEM file for TLS
--tlsCAFile arg Certificate Authority file for TLS
--tlsCRLFile arg Certificate Revocation List file for TLS
--tlsAllowInvalidHostnames Allow connections to servers with
non-matching hostnames
--tlsAllowInvalidCertificates Allow connections to servers with
invalid certificates
--tlsFIPSMode Activate FIPS 140-2 mode at startup
--tlsDisabledProtocols arg Comma separated list of TLS protocols to
disable [TLS1_0,TLS1_1,TLS1_2]
Authentication Options:
-u [ --username ] arg username for authentication
-p [ --password ] arg password for authentication
--authenticationDatabase arg user source (defaults to dbname)
--authenticationMechanism arg authentication mechanism
--gssapiServiceName arg (=mongodb) Service name to use when authenticating
using GSSAPI/Kerberos
--gssapiHostName arg Remote host name to use for purpose of
GSSAPI/Kerberos authentication
file names: a list of files to run. files have to end in .js and will exit after unless --shell is specified
[root@localhost mongodb]#
可选参数如下
mongo -u <user> -p <pass> --host <host> --port <port>
参数 | 说明 |
---|---|
–port | 端口号, 未指定为默认端口 27017 |
-u / -username | 用户名 |
-p / -password | 密码 |
-authenticationDatabase | 认证数据库 |
本地客户端可直接mongo 启动
[root@localhost mongodb]# mongo
Mongo Shell 常用命令
数据库常用命令
show dbs / show databases 命令
概念
显示数据库列表
命令应用
> show dbs;
admin 0.000GB
config 0.000GB
local 0.000GB
use 数据库名 命令
概念
切换数据库,数据库不存在时会自动创建
命令应用
> show dbs;
admin 0.000GB
config 0.000GB
local 0.000GB
db.dropDatabase() 命令
概念
删除集合
命令应用
> db.emp.drop()
true
> show collections
集合常见操作
show collections / show tables 查看集合命令
概念
查询当前数据库的集合列表数据
命令应用
> show dbs
admin 0.000GB
config 0.000GB
local 0.000GB
> use test
switched to db test
> db.emp.insert({i:1})
WriteResult({ "nInserted" : 1 })
> show collections
emp
db.collections(集合名).stats() 查看集合详情命令
概念
查看集合详情
命令应用
> db.emp.stats()
{
"ns" : "test.emp",
"size" : 33,
"count" : 1,
"avgObjSize" : 33,
"storageSize" : 20480,
"freeStorageSize" : 0,
"capped" : false,
"wiredTiger" : {
"metadata" : {
"formatVersion" : 1
},
...
"scaleFactor" : 1,
"ok" : 1
}
db.collections(集合名).drop() 删除集合 命令
概念
删除集合
命令应用
> db.emp.drop()
true
> show collections
用户角色命令
show roles 查看角色列表命令
概念
查看角色列表
命令应用
> show roles
{
"role" : "dbAdmin",
"db" : "test",
"isBuiltin" : true,
"roles" : [ ],
"inheritedRoles" : [ ]
}
{
"role" : "dbOwner",
"db" : "test",
"isBuiltin" : true,
"roles" : [ ],
![img](https://img-blog.csdnimg.cn/img_convert/6db8457034c3baf2ef0f8fc35a6566f3.png)
![img](https://img-blog.csdnimg.cn/img_convert/616e2dfe3196681332638b12ff47b998.png)
**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**
**[需要这份系统化的资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618636735)**
**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**
n" : true,
"roles" : [ ],
[外链图片转存中...(img-mNAa3Lj9-1715746882869)]
[外链图片转存中...(img-OqfqOcIZ-1715746882870)]
**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**
**[需要这份系统化的资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618636735)**
**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**