赞
踩
[root@localhost ~]# docker exec -it mongodb mongosh
Current Mongosh Log ID: 66a99c147066bd635ba48ced
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.10.6
Using MongoDB: 7.0.0
Using Mongosh: 1.10.6
For mongosh info see: https://docs.mongodb.com/mongodb-shell/
------
The server generated these startup warnings when booting
2024-07-30T10:58:29.512+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
2024-07-30T10:58:29.513+00:00: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'
2024-07-30T10:58:29.513+00:00: /sys/kernel/mm/transparent_hugepage/defrag is 'always'. We suggest setting it to 'never'
2024-07-30T10:58:29.513+00:00: vm.max_map_count is too low
------
test>
test> use atguigu
switched to db atguigu
atguigu> db.myCollection.insert({name:'小明',age:20})
DeprecationWarning: Collection.insert() is deprecated. Use insertOne, insertMany, or bulkWrite.
{
acknowledged: true,
insertedIds: { '0': ObjectId("66a99e507066bd635ba48cef") }
}
atguigu>
atguigu> show dbs
admin 40.00 KiB
atguigu 40.00 KiB
config 96.00 KiB
local 72.00 KiB
atguigu> show collections
myCollection
atguigu> db.createCollection("myCollection2")
{ ok: 1 }
atguigu> show collections
myCollection
myCollection2
atguigu> db.myCollection2.drop()
true
atguigu> show collections
myCollection
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。