Why MongoDB does not support joins?
Answers
MongoDB supports joins since version 3.2 via the $lookup operator in the aggregation pipeline. Example:
db.orders.aggregate([
{
$lookup: {
from: "customers",
localField: "customer_id",
foreignField: "_id",
as: "customer_info"
}
}
])
Add a comment ▾
db.orders.aggregate([
{
$lookup: {
from: "customers",
localField: "customer_id",
foreignField: "_id",
as: "customer_info"
}
}
])