当前位置:网站首页>mongodb文档间关系
mongodb文档间关系
2022-07-05 20:11:00 【为什么不好好卖蛋饼】
12 文档间关系
一对一
内嵌文档形式
相对来说少
db.wifeAndHusband.insert([{
name:"黄蓉",
husband:{
name:"郭靖"
}
}])
一对多
用户–》订单
db.order.insert({
list:["牛肉","漫画"],
user_id:ObjectId("hhjhdfgjk");
})
//查找用户swk的订单
var user_id=db.users.findOne({username:"swk"})._id;
db.order.find({user_id:user_id});
多对多
db.teacher.insert([
{
name:"共妻宫"},
{
name:"龟仙人"}
]);
db.stus.insert([
{
name:"郭靖",
tech_ids:[
ObjectId("kkkk"),
ObjectId("djslgkdj")
]
}
]);
边栏推荐
- 港股将迎“最牛十元店“,名创优品能借IPO突围?
- CCPC 2021威海 - G. Shinyruo and KFC(组合数,小技巧)
- 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
- 怎么挑选好的外盘平台,安全正规的?
- 银河证券在网上开户安全吗?
- 点云文件的.dat文件读取保存
- IC科普文:ECO的那些事儿
- Float. The specific meaning of the return value of floattorawintbits is to convert float into byte array
- 618 "low key" curtain call, how can baiqiushangmei join hands with the brand to cross the "uncertain era"?
- DP:树DP
猜你喜欢
Leetcode skimming: binary tree 16 (path sum)
微信小程序正则表达式提取链接
Securerandom things | true and false random numbers
JVMRandom不可设置种子|问题追溯|源码追溯
[quick start to digital IC Verification] 8. Typical circuits in digital ICs and their corresponding Verilog description methods
ROS2专题【01】:win10上安装ROS2
IC科普文:ECO的那些事儿
leetcode刷题:二叉树10(完全二叉树的节点个数)
Interviewer: what is the internal implementation of set data types in redis?
Scala基础【HelloWorld代码解析,变量和标识符】
随机推荐
618 "low key" curtain call, how can baiqiushangmei join hands with the brand to cross the "uncertain era"?
.Net分布式事務及落地解决方案
中金财富在网上开户安全吗?
Autumn byte interviewer asked you any questions? In fact, you have stepped on thunder
What is PyC file
1:引文;
Let's talk about threadlocalinsecurerandom
Win10 x64环境下基于VS2017和cmake-gui配置使用zxing以及opencv,并实现data metrix码的简单检测
Debezium series: record the messages parsed by debezium and the solutions after the MariaDB database deletes multiple temporary tables
挖财钱堂教育靠谱安全吗?
Go language | 01 wsl+vscode environment construction pit avoidance Guide
How to select the Block Editor? Impression notes verse, notation, flowus
期货如何网上开户?安不安全?
ACM getting started Day1
sun.misc.BASE64Encoder报错解决方法[通俗易懂]
Bzoj 3747 poi2015 kinoman segment tree
【数字IC验证快速入门】2、通过一个SoC项目实例,了解SoC的架构,初探数字系统设计流程
什么是pyc文件
怎么挑选好的外盘平台,安全正规的?
2023年深圳市绿色低碳产业扶持计划申报指南