Ok i am trying to implement a query, which is trying to perform regex search ( which contains an array list ) on a bunch of document
Its hard for me to explain...so
Here is simple way to transform /.*/ style regex.
var sea = [ "/xd/", "/sd/", "/ad/" ]; var rx = []; sea.forEach(function name(value) { var v = value.replace(/\//ig,""); rx.push(new RegExp(v)); }); db.paper.find({"category": {$in: rx}});