Skip to content

Instantly share code, notes, and snippets.

@sjcotto
Last active August 29, 2015 14:08
Show Gist options
  • Save sjcotto/08bc8a1edb44cbe37b30 to your computer and use it in GitHub Desktop.
Save sjcotto/08bc8a1edb44cbe37b30 to your computer and use it in GitHub Desktop.
kona
var model = kona.model.open('employee');
var find = function(req) {
var name = req.params.get("name");
var find = [
{
first : {
$regex : ".*" + name + ".*",
$options: 'i'
}
},
{
last : {
$regex : ".*" + name + ".*",
$options: 'i'
}
}
];
var obj = {
$or : find
}
return model.buildQuery().find(toJson(obj)).list();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment