当前位置:网站首页>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")
]
}
]);
边栏推荐
- 股票开户哪里好?网上客户经理开户安全吗
- ICTCLAS word Lucene 4.9 binding
- 【数字IC验证快速入门】3、数字IC设计全流程介绍
- 深度学习 卷积神经网络(CNN)基础
- DP:树DP
- Go language | 01 wsl+vscode environment construction pit avoidance Guide
- 实操演示:产研团队如何高效构建需求工作流?
- leetcode刷题:二叉树14(左叶子之和)
- 图嵌入Graph embedding学习笔记
- Leetcode skimming: binary tree 17 (construct binary tree from middle order and post order traversal sequence)
猜你喜欢
Go language | 02 for loop and the use of common functions
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
- Oui. Net Distributed Transaction and Landing Solution
ROS2专题【01】:win10上安装ROS2
ACM getting started Day1
Go language | 03 array, pointer, slice usage
【数字IC验证快速入门】8、数字IC中的典型电路及其对应的Verilog描述方法
Securerandom things | true and false random numbers
How to safely and quickly migrate from CentOS to openeuler
图嵌入Graph embedding学习笔记
随机推荐
-v parameter of GST launch
Hong Kong stocks will welcome the "best ten yuan store". Can famous creative products break through through the IPO?
MySql的root密码忘记该怎么找回
什么是pyc文件
基金网上开户安全吗?去哪里开,可以拿到低佣金?
强化学习-学习笔记4 | Actor-Critic
Process file and directory names
浅浅的谈一下ThreadLocalInsecureRandom
Float. The specific meaning of the return value of floattorawintbits is to convert float into byte array
【数字IC验证快速入门】8、数字IC中的典型电路及其对应的Verilog描述方法
点云文件的.dat文件读取保存
Debezium series: parsing the default value character set
2022年7月4日-2022年7月10日(ue4视频教程mysql)
Debezium series: idea integrates lexical and grammatical analysis ANTLR, and check the DDL, DML and other statements supported by debezium
Analysis of openh264 decoded data flow
Complete interview questions for interviewers and senior Android engineers in front-line Internet enterprises
After 95, Alibaba P7 published the payroll: it's really fragrant to make up this
股票开户哪里好?网上客户经理开户安全吗
2023年深圳市绿色低碳产业扶持计划申报指南
Debezium series: record the messages parsed by debezium and the solutions after the MariaDB database deletes multiple temporary tables