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
Post a Comment