For such wildcards, you can use a regex that looks something like this:
db.collection.find({"path": new RegExp("foo/bar/.*?/somethingelse")})
, single {"path":"foo/bar/{id}/somethingelse"}, , db.collection.find({path:"foo/bar/1/somethingelse"}). , , , , .
path = path.replace(/foo\/bar\/(.*)\/somethingelse/, 'foo/bar/{id}/somethingelse')
db.collection.find({path:path})
, !
, , . , .
path.replace(/foo\/bar\/(.*)\/somethingelse/, 'foo/bar/($1|{id}|\*)/somethingelse')
db.collection.find({path: new RegExp(path)})