[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>
atguigu> db.myCollection.insert({name:'小明',age:20})
DeprecationWarning: Collection.insert() is deprecated. Use insertOne, insertMany, or bulkWrite.{
acknowledged: true,
insertedIds:{'0':ObjectId("66a99e507066bd635ba48cef")}}
atguigu>
4、查看数据库列表
atguigu> show dbs
admin 40.00 KiB
atguigu 40.00 KiB
config 96.00 KiB
local 72.00 KiB
5、查看集合
atguigu> show collections
myCollection
6、显示创建集合
atguigu> db.createCollection("myCollection2"){ ok:1}
atguigu> show collections
myCollection
myCollection2
7、删除集合
atguigu> db.myCollection2.drop()
true
atguigu> show collections
myCollection
1.初始化列表
初始化列表:以一个冒号开始,接着是一个以逗号分隔的数据成员列表,每个"成员变量"后面跟一个放在括 号中的初始值或表达式。
class Date
{
public:Date(int year, int month, int day): _year(year), _month(month),…
目录 一.结构体变量直接赋值
二.视频教程 一.结构体变量直接赋值
通过上节课的学习得出了一个结论:俩个相同类型的结构体变量直接可以只用赋值号进行赋值。
像这样:
struct test {int a;int b;
};int main(void)
{struct test x {1,2};struct test …