0
我正在建立自己的查询与npm mongo-query-generator和我在报价条件。有什么办法删除这些引号,以便我可以正确地应用正则表达式吗?Mongo正则表达式查询删除引号
我目前有:
db.getCollection('products').find(
{"$and":
[{"$or": [
{"category": "/cteos/i"},
{"category": "/especiales/i"} ]}
,{"category": "/huevos/i"}
]})
我想要什么:
db.getCollection('products').find(
{"$and":
[{"$or": [
{"category": /cteos/i},
{"category": /especiales/i} ]}
,{"category": /huevos/i}
]})
你确定你需要删除引号?有[另一种方式](http://stackoverflow.com/a/494046/6083675)在JS中使用正则表达式。 – Laurel
我目前使用正则表达式的方法,但我可以通过使用mongo $正则表达式保留引号 – Rober