当前位置:网站首页>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")
]
}
]);
边栏推荐
- A way to calculate LNX
- Process file and directory names
- Go language learning tutorial (16)
- Some problems encountered in cocos2d-x project summary
- 点云文件的.dat文件读取保存
- Oracle-表空间管理
- Elk distributed log analysis system deployment (Huawei cloud)
- Solve the problem that the database configuration information under the ThinkPHP framework application directory is still connected by default after modification
- 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
- 随机数生成的四种方法|Random|Math|ThreadLocalRandom|SecurityRandom
猜你喜欢

Wechat applet regular expression extraction link

- Oui. Net Distributed Transaction and Landing Solution
![[quick start of Digital IC Verification] 7. Basic knowledge of digital circuits necessary for verification positions (including common interview questions)](/img/90/aad9d7900d686efca10140717a5c5c.png)
[quick start of Digital IC Verification] 7. Basic knowledge of digital circuits necessary for verification positions (including common interview questions)

【数字IC验证快速入门】7、验证岗位中必备的数字电路基础知识(含常见面试题)

How to select the Block Editor? Impression notes verse, notation, flowus

【数字IC验证快速入门】9、Verilog RTL设计必会的有限状态机(FSM)
Complete interview questions for interviewers and senior Android engineers in front-line Internet enterprises

图嵌入Graph embedding学习笔记

零道云新UI设计中

leetcode刷题:二叉树11(平衡二叉树)
随机推荐
What is PyC file
kubernetes资源对象介绍及常用命令(五)-(ConfigMap&Secret)
A way to calculate LNX
2023年深圳市绿色低碳产业扶持计划申报指南
Interviewer: what is the internal implementation of set data types in redis?
挖财钱堂教育靠谱安全吗?
[quick start of Digital IC Verification] 1. Talk about Digital IC Verification, understand the contents of the column, and clarify the learning objectives
Float. The specific meaning of the return value of floattorawintbits is to convert float into byte array
港股将迎“最牛十元店“,名创优品能借IPO突围?
.Net分布式事務及落地解决方案
Flume series: interceptor filtering data
DP:树DP
点云文件的.dat文件读取保存
DP: tree DP
Codeforces Round #804 (Div. 2) - A, B, C
Summer Challenge harmonyos - realize message notification function
建立自己的网站(16)
E. Singhal and Numbers(质因数分解)
微信小程序正则表达式提取链接
Securerandom things | true and false random numbers