Painting Blue Code
Simple, self-explanatory code snippets.
2017-01-10
MongoDB - How to make a case insensitive query/filter
db.
collection_name
.
find
({
"
field_name
":
/^
search_term_here
/
i
});
PS. Make sure to use "^" in order for the query to use the index, if available, to avoid a full scan.
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment