Mongodb AWS DocumentDB是否支持加入3+;单个查询中的集合?
是否可以通过单个查询将AWS DocumentDB中的3个独立集合连接在一起(类似于此处线程的解决方案: 我觉得可能不是,但我不认为AWS是直接出来的,而且在任何地方都明确这样说 报告说: Amazon DocumentDB支持进行相等匹配的功能(例如 例如,左外联接),但不支持不相关 子查询 如果我知道什么是“不相关子查询”,那将更有帮助 另外,表示完全不支持Mongodb AWS DocumentDB是否支持加入3+;单个查询中的集合?,mongodb,nosql,aws-documentdb,Mongodb,Nosql,Aws Documentdb,是否可以通过单个查询将AWS DocumentDB中的3个独立集合连接在一起(类似于此处线程的解决方案: 我觉得可能不是,但我不认为AWS是直接出来的,而且在任何地方都明确这样说 报告说: Amazon DocumentDB支持进行相等匹配的功能(例如 例如,左外联接),但不支持不相关 子查询 如果我知道什么是“不相关子查询”,那将更有帮助 另外,表示完全不支持$let变量运算符。他们所指的$let变量运算符是否与$lookup阶段中的let表达式完全相同,该阶段在以下查询中用于连接3个集合 d
$let
变量运算符。他们所指的$let
变量运算符是否与$lookup
阶段中的let
表达式完全相同,该阶段在以下查询中用于连接3个集合
db.customers.aggregate([
{
$lookup: {
from: "orders",
let: { customer_id: "$customer_id" },
pipeline: [
{ $match: { $expr: { $eq: ["$$customer_id", "$customer_id"] } } },
{
$lookup: {
from: "orderitems",
localField: "order_id",
foreignField: "order_id",
as: "items"
}
}
],
as: "orders"
}
}
])
在AWS DocumentDB中,在单个NoSQL查询中加入3+个集合是否可行?如果不可行,建议/最有效的方法是什么?中:
Amazon DocumentDB支持进行相等匹配(例如,左外连接),但不支持不相关的子查询
在:
相等匹配具有以下语法:
{
$lookup:
{
from: <collection to join>,
localField: <field from the input documents>,
foreignField: <field from the documents of the "from" collection>,
as: <output array field>
}
}
{
$lookup:
{
from: <collection to join>,
let: { <var_1>: <expression>, …, <var_n>: <expression> },
pipeline: [ <pipeline to execute on the collection to join> ],
as: <output array field>
}
}
{
$lookup:
{
发件人:,
localField:,
外域:,
作为:
}
}
不相关子查询具有以下语法:
{
$lookup:
{
from: <collection to join>,
localField: <field from the input documents>,
foreignField: <field from the documents of the "from" collection>,
as: <output array field>
}
}
{
$lookup:
{
from: <collection to join>,
let: { <var_1>: <expression>, …, <var_n>: <expression> },
pipeline: [ <pipeline to execute on the collection to join> ],
as: <output array field>
}
}
{
$lookup:
{
发件人:,
让:{:,…,:},
管道:[],
作为:
}
}
因此DocumentDB中不支持第二种语法。请参阅(连接条件和不相关子查询)[连接条件和不相关子查询]在MongoDB 3.6中引入。我相信DocumentDB与MongoDB 3.4具有相同的功能。如果你想发布链接,它就不起作用。是的,搞砸了。我试图链接到我仍然不明白不相关的子查询是什么。该页面并没有真正分解该术语的含义。你能详细说明该术语的含义吗?