Im using python and it seems like this part of the docs lack a python translation. Is it even possible to use this feature with python?
If i for example save nodes like this: [{ "_id": "Programming", "path": ",Books," }, { "_id": "Databases", "path": ",Books,Programming," }]
and then query the data like this: db.categories.find( { path: "^,Books," } )
I dont get any output. Maybe it’s not even thought to implement this with python. What can I do?
edit: note, that I changed the statements to work with python. I put quotation marks around the “_id” and the “path” statements, as well as around the statement in the “find” function.
@steevej suggestion is correct, you should use the $regex operator in Python passing everything as a dictionary for it’s options. This will allow you to perform the necessary regular expression searching that is discussed in the manual page you’ve referenced.
If you have more specific Python questions, I’d ask them in the Drivers & ODM category as there will be more readers there who have greater familiarity with using regular expressions and Python.
This code segment should be sufficient to give an indicative step on where to go next. In terms of follow-ups, I’d suggest you post further questions to Working with Data or to ODM & Drivers as this has moved outside of the scope of M220P and there will be a wider pool of viewers in those forums who can provide further assistance should you require it.