Meteor-Community-Packages / Meteor-Community-Packages/meteor-autocomplete

Issue with selector with regex in return

Open
#81 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
CoffeeScript
Stars
350
Forks
106
PR merge metrics
No merged PRs in 30d

Description

I have seen a few examples like below:

```
selector: function(match) {
regex = new RegExp(match, 'i')
return {'profile.firstName': regex}
}
```

I am actually trying the code above. If I put a string in place of `regex`, it is passed and works correctly, but when I use the `regex` variable, the output sent to query looks like this `'profile.firstName': {} } { limit: 10, sort: { _id: 1 } }`. Notice the `regex` portion is missing.

Anyway, I am not sure why this doesn't work yet. Any thoughts?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named; begin at the selector callback and the query-serialization entry point described in the report. Reproduce the difference between returning a string and a RegExp, then determine whether regex selectors are supported and verify that the resulting query is preserved or the limitation is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.