mongodb - Mongo query where parameter starts with field value -


i have preference objects like:

 {_id: ...,  group: 'mycode',  path: '/some/path/'  value: 123} 

and want lookup preferences match specific url, e.g. /some/path/123

i can't $regex since parameter longer field value, looking @ doing $where query like:

 db.coll.find({group: 'mycode', $where: "'/some/path/123'.indexof(this.path) >= 0"}); 

it feels there should better way of doing this, since it's basic feature of sql. missing better way?


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -