Stable API strict and $graphLookup

Hi folks,

As per my understanding, only the commands listed in Stable API Changelog should be accepted when we connect to the server with Stable API in strict mode, but in my tests, I can run $graphLookup in both mongo shell and pymongo without any problems. Is it by design?

#!/usr/bin/env python3

import pymongo
from pymongo import MongoClient
from pymongo.server_api import ServerApi
import pprint

uri = "mongodb://testuser:XXXX@localhost:27047"

pipeline = [
  { "$match": {"name": "wlt"} },
  {
    "$graphLookup": {
        "from": "employees",
        "startWith": "$reportsTo",
        "connectFromField": "reportsTo",
        "connectToField": "name",
        "as": "reportingHierarchy",
        "maxDepth": 1
    }
  }
]

with MongoClient(uri, server_api=ServerApi("1", strict=True, deprecation_errors=True)) as client:
  database = client["test"]
  collection = database["employees"]
  pprint.pprint(list(collection.aggregate(pipeline)))

MongoDB v5.0.23
Pymongo v4.1.1
Mongo Shell v2.2.6

Thanks for pointing this out. Yes $graphLookup is included in the Stable API. We’ve filed an internal issue to update the docs page to better mention which aggregation stages are included.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.