Thank you! That was exactly what i was looking for. I do not want meteor to completely remove case sensitivity, maybe it came out that way. I just wanted a way to solve my problem. Thanks!
var escapeRegex = function (oldText) {
"use strict";
var sre = new RegExp('(\\' + ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '^', '\\', '$'].join('|\\') + ')', 'g');
return oldText.replace(sre, '\\$1');
};
Add ^ and $ to the beginning and end so you match only that, and escape their query:
Meteor.publish("search", function (query) {
var re = new RegExp('^' + escapeRegex(query) + '$', 'i');
return Test.find({"something": {$regex: re}});
});