I'm trying to query MongoDB using spring but I can't get my regex to work.
I have a tree in mongodb as Materialized Paths as in MongoDB docs (http://www.mongodb.org/display/DOCS/Trees+in+MongoDB).
In the shell the query
db.categories.find({path:/^\w+,$/})
works fine to find the path before the first comma.
Ex.: {"path" : "a,"} gets returned but not {"path: "a,b,"} which is what I want.
How do I make the same query in spring? I've tried:
new Query(Criteria.where("path").regex("/^\\w+,$/"))
but this doesn't work.
Thank you