christkv/node-mongodb-native — Issue #485: Distinct does not support regular expressions
Author: chmoder
Created: 2012-01-23 02:08:57+00:00
State: open

From what I can tell the collection.distinct() method does not support regular expressions. Am I doing something wrong? If not will this be supported in the future? All three below return an empty set.

collection.distinct(key, {somekey: /^a/ }, function(err, items) {
// stuff
});

collection.distinct(key, {somekey: new RegExp('^a') }, function(err, items) {
// stuff
});

collection.distinct(key, {somekey: {$regex: '^a') } }, function(err, items) {
// stuff
});