当前位置:网站首页>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")
]
}
]);
边栏推荐
- Is the education of caiqiantang reliable and safe?
- Go language | 02 for loop and the use of common functions
- Is it safe for CICC fortune to open an account online?
- CTF逆向基础
- Is it safe for Guosen Securities to open an account online?
- Based on vs2017 and cmake GUI configuration, zxing and opencv are used in win10 x64 environment, and simple detection of data matrix code is realized
- Oracle tablespace management
- DP:树DP
- Leetcode skimming: binary tree 16 (path sum)
- How to choose a good external disk platform, safe and formal?
猜你喜欢
Guidelines for application of Shenzhen green and low carbon industry support plan in 2023
After 95, Alibaba P7 published the payroll: it's really fragrant to make up this
【数字IC验证快速入门】7、验证岗位中必备的数字电路基础知识(含常见面试题)
Leetcode(695)——岛屿的最大面积
【数字IC验证快速入门】2、通过一个SoC项目实例,了解SoC的架构,初探数字系统设计流程
IC科普文:ECO的那些事儿
leetcode刷题:二叉树12(二叉树的所有路径)
CADD课程学习(7)-- 模拟靶点和小分子相互作用 (半柔性对接 AutoDock)
Scala basics [HelloWorld code parsing, variables and identifiers]
leetcode刷题:二叉树16(路径总和)
随机推荐
Is it safe for Guosen Securities to open an account online?
[quick start of Digital IC Verification] 9. Finite state machine (FSM) necessary for Verilog RTL design
model方法
. Net distributed transaction and landing solution
A way to calculate LNX
USACO3.4 “破锣摇滚”乐队 Raucous Rockers - DP
1: Citation;
C - sequential structure
Summer Challenge harmonyos - realize message notification function
[quick start of Digital IC Verification] 6. Quick start of questasim (taking the design and verification of full adder as an example)
leetcode刷题:二叉树12(二叉树的所有路径)
Oracle tablespace management
怎么挑选好的外盘平台,安全正规的?
leetcode刷题:二叉树16(路径总和)
Reinforcement learning - learning notes 4 | actor critical
leetcode刷题:二叉树10(完全二叉树的节点个数)
[quick start to digital IC Verification] 8. Typical circuits in digital ICs and their corresponding Verilog description methods
图嵌入Graph embedding学习笔记
Go language | 03 array, pointer, slice usage
14. Users, groups, and permissions (14)