In MongoDB collection, I have materialized path tree model like:
",Books,Programming,Databases,NoSQL,"
",Books,Programming,Databases,SQL,"
For fetching all descendants of Programming used:
db.categories.find( { path: /,Programming,/ } )
Is any availability to create request that will find only direct descendants Programming? I.e. will find records with Databases but not with NoSQL and SQL.
Use
/,Programming,[^,]+,$/
The [^,]+, pattern matches 1 or more symbols other than a comma ([^,]+) and the , matches a literal comma. $ is the end-of-string anchor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With