|
It turns out $sql is not a stage that can be used in an aggregation that is executed on a collection.
Essentially, it is not used like this:
db.listingsAndReviews.aggregate([{
|
$sql: {
|
statement: 'select * from listingsAndReviews limit 2',
|
format: 'jdbc',
|
dialect: 'mysql'
|
}
|
}]);
|
it is used like this:
db.adminCommand({
|
aggregate: 1,
|
pipeline: [
|
$sql: {
|
statement: 'select * from listingsAndReviews limit 2',
|
format: 'jdbc',
|
dialect: 'mysql'
|
}
|
]
|
});
|
additionally, in terms of use cases, $sql is built to support JDBC connections rather than as a user-facing stage. Therefore, it should be removed.
|