Getting ancestors in MongoDb using tree structure
问题 I have the following collection representing the directory structure. I'd like to write an aggregation query that will return all child directory IDs starting from a certain point . For example: Starting from root : results: child_A , child_B , child_A_1 Starting from child_a : results: child_A_1 I've created the following query (in Mongo 4.2) according to the docs, but I'm unable to run it successfully. [{ $match: { _id: ObjectId('5de7a00bf3663d0805644b91') } }, { $graphLookup: { from: