diegohaz / querymen

Querystring parser middleware for MongoDB, Express and Nodejs (MEN)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

question on querymen default schema

khelkun opened this issue · comments

In the README:

User requests /posts?q=term&fields=title,desc req.querymen will be:

When user requests /posts?q=term, querymen parses it to {keywords: /term/i}. It was designed to work with mongoose-keywords plugin, which adds a keywords field to schemas (check that out).

I did look at mongoose-keywords but I have to admit that I don't really understand how it works. Anyway the querymen README says "When user requests /posts?q=term, querymen parses it to {keywords: /term/i}". My question would be what's 'i' in 'term/i'?

commented

Hi, @khelkun

That's a regular expression. i means case insensitive.

oh yes javascript regex, I should have figured that out . Sorry my bad.