当前位置:网站首页>Relationship between mongodb documents
Relationship between mongodb documents
2022-07-05 20:17:00 【Why not sell egg cakes well】
12 Relationship between documents
one-on-one
Embedded document form
Relatively few
db.wifeAndHusband.insert([{
name:" Huang Rong ",
husband:{
name:" Guo Jing "
}
}])
One to many
user –》 Order
db.order.insert({
list:[" beef "," comic "],
user_id:ObjectId("hhjhdfgjk");
})
// Find user swk The order of
var user_id=db.users.findOne({username:"swk"})._id;
db.order.find({user_id:user_id});
Many to many
db.teacher.insert([
{
name:" Common wife Palace "},
{
name:" Tortoise Fairy "}
]);
db.stus.insert([
{
name:" Guo Jing ",
tech_ids:[
ObjectId("kkkk"),
ObjectId("djslgkdj")
]
}
]);
边栏推荐
- 【数字IC验证快速入门】9、Verilog RTL设计必会的有限状态机(FSM)
- Leetcode skimming: binary tree 12 (all paths of binary tree)
- Debezium series: modify the source code to support UNIX_ timestamp() as DEFAULT value
- 实操演示:产研团队如何高效构建需求工作流?
- Parler de threadlocal insecurerandom
- Mysql频繁操作出现锁表问题
- leetcode刷题:二叉树13(相同的树)
- leetcode刷题:二叉树15(找树左下角的值)
- 浅浅的谈一下ThreadLocalInsecureRandom
- Elk distributed log analysis system deployment (Huawei cloud)
猜你喜欢

解决Thinkphp框架应用目录下数据库配置信息修改后依然按默认方式连接

ROS2专题【01】:win10上安装ROS2

Leetcode skimming: binary tree 10 (number of nodes of a complete binary tree)

基础篇——配置文件解析

Leetcode skimming: binary tree 16 (path sum)

Convolution free backbone network: Pyramid transformer to improve the accuracy of target detection / segmentation and other tasks (with source code)

Guidelines for application of Shenzhen green and low carbon industry support plan in 2023

Go language | 02 for loop and the use of common functions

Leetcode brush question: binary tree 13 (the same tree)
![信息学奥赛一本通 1339:【例3-4】求后序遍历 | 洛谷 P1827 [USACO3.4] 美国血统 American Heritage](/img/f0/0f985425bd61d9852af0b5fd7307ee.png)
信息学奥赛一本通 1339:【例3-4】求后序遍历 | 洛谷 P1827 [USACO3.4] 美国血统 American Heritage
随机推荐
mongodb基操的练习
19 Mongoose模块化
sort和投影
leetcode刷题:二叉树15(找树左下角的值)
信息学奥赛一本通 1337:【例3-2】单词查找树 | 洛谷 P5755 [NOI2000] 单词查找树
Enter the parallel world
How to choose a good external disk platform, safe and formal?
Leetcode(695)——岛屿的最大面积
浅浅的谈一下ThreadLocalInsecureRandom
SecureRandom那些事|真伪随机数
Is the education of caiqiantang reliable and safe?
Go language | 02 for loop and the use of common functions
1:引文;
Summer Challenge harmonyos - realize message notification function
基金网上开户安全吗?去哪里开,可以拿到低佣金?
Unity编辑器扩展 UI控件篇
kubernetes资源对象介绍及常用命令(五)-(ConfigMap&Secret)
IC科普文:ECO的那些事儿
Solve the problem that the database configuration information under the ThinkPHP framework application directory is still connected by default after modification
死信队列入门(两个消费者,一个生产者)