跳至主要內容

MongoTemplate基本操作

小企鹅使用指南数据库小于 1 分钟约 101 字...

MongoTemplate基本操作

提示

本章基于 MongoTemplate 对数据库进行操作

Aggregation的使用

sort

unwind

::: important

newAggregation 中,参数的顺序会影响查询结果,要注意 unwind 的顺序

:::

将一个子文档的列表拆开,例如:

{
  "project_name": "Hunting Sniper",
  "version": [
    {
      "platform_id": "65e18dfaff522d2820ed53d6"
    },
    {
      "platform_id": "65e18ee4ff522d2820ed53d8"
    }
  ]
}

会被拆为:

{
  "project_name": "Hunting Sniper",
  "version":
    {
      "platform_id": "65e18dfaff522d2820ed53d6"
    }
},
{
  "project_name": "Hunting Sniper",
  "version":
    {
      "platform_id": "65e18ee4ff522d2820ed53d8"
    }
}
上次编辑于:
你认为这篇文章怎么样?
  • 0
  • 0
  • 0
  • 0
  • 0
  • 0
评论
  • 按正序
  • 按倒序
  • 按热度