最新的 Stitch 不支持 $lookup 吗?我正在使用 mongodb-stitch-server-sdk@4.3.2 并且我的服务器版本为 4.0.6。我有如下查询:
const {
Stitch,
UserPasswordCredential,
RemoteMongoClient
} = require('mongodb-stitch-server-sdk');
const client = Stitch.initializeDefaultAppClient('<APP ID>');
client.auth.loginWithCredential(new UserPasswordCredential("<username>","<password>")).then(user => {
client.close();
}).catch(err => {
console.log(err);
client.close();
})
mongodb = client.getServiceClient(
RemoteMongoClient.factory,
"fleet-home")
testQuery =
[{
$match: {
_id: "c1ba5c3f-263b-5748-9492-e50e0a39cb7a"
}
},
{
$lookup: {
from: "aircraft",
localField: "aircraft_id",
foreignField: "_id",
as: "aircraft"
}
}]
test = mongodb
.db("FleetDatabase")
.collection("fleet")
.aggregate(testQuery)
.asArray().then((success) => {
console.log(success)
})
但是,我收到一个错误UnhandledPromiseRejectionWarning: StitchServiceError: aggregation stage "$lookup" is not supported