当前位置:网站首页>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")
]
}
]);
边栏推荐
- sun. misc. Base64encoder error reporting solution [easy to understand]
- Go language learning tutorial (16)
- CADD课程学习(7)-- 模拟靶点和小分子相互作用 (半柔性对接 AutoDock)
- Go language | 02 for loop and the use of common functions
- 全国爱眼教育大会,2022第四届北京国际青少年眼健康产业展会
- 【c语言】归并排序
- 《乔布斯传》英文原著重点词汇笔记(十二)【 chapter ten & eleven】
- Is it safe for CICC fortune to open an account online?
- document方法
- Mysql频繁操作出现锁表问题
猜你喜欢
Jvmrandom cannot set seeds | problem tracing | source code tracing
leetcode刷题:二叉树11(平衡二叉树)
Elk distributed log analysis system deployment (Huawei cloud)
Leetcode brush question: binary tree 14 (sum of left leaves)
Wechat applet regular expression extraction link
leetcode刷题:二叉树17(从中序与后序遍历序列构造二叉树)
JS implementation prohibits web page zooming (ctrl+ mouse, +, - zooming effective pro test)
How to select the Block Editor? Impression notes verse, notation, flowus
Oracle-表空间管理
Leetcode: binary tree 15 (find the value in the lower left corner of the tree)
随机推荐
19 Mongoose模块化
c語言oj得pe,ACM入門之OJ~
mongodb/文档操作
Notes on key vocabulary in the English original of the biography of jobs (12) [chapter ten & eleven]
ICTCLAS word Lucene 4.9 binding
sort和投影
Flume series: interceptor filtering data
C language OJ gets PE, OJ of ACM introduction~
Process file and directory names
1:引文;
leetcode刷题:二叉树13(相同的树)
Cocos2d-x项目总结中的一些遇到的问题
y57.第三章 Kubernetes从入门到精通 -- 业务镜像版本升级及回滚(三十)
DP: tree DP
js方法传Long类型id值时会出现精确损失
Let's talk about threadlocalinsecurerandom
DP:树DP
字节跳动Dev Better技术沙龙成功举办,携手华泰分享Web研发效能提升经验
leetcode刷题:二叉树18(最大二叉树)
Go language | 01 wsl+vscode environment construction pit avoidance Guide