Skip to content

Commit

Permalink
update mongodb
Browse files Browse the repository at this point in the history
  • Loading branch information
rbmonster committed Jan 12, 2023
1 parent 92f75a9 commit 33f3729
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/java/com/other/MONGODB.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,26 @@ db.helloworld.dropIndex("username_1")
```


查询数组中的值
```text
db.getCollection('crm_form_answer_whole').aggregate([
{
$unwind:{
path:'$answers',
includeArrayIndex: 'index'
}
},{"$match":{"formAnswerId":"13990100447000021072800010001"}}
,
{
$project: {
_id: 0,
"questionId": "$answers.questionId",
}
}
])
```

## 应用场景
设计的两个关键,一个重要问题:
- 范式化:将数据分散到不同的集合中,数据类似与关系型数据一样,使用主键关联。
Expand Down

0 comments on commit 33f3729

Please sign in to comment.