sails-disk
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -429,3 +429,3 @@ /** | ||
// Normalize the stage-3 query criteria into NeDB (really, MongoDB) criteria. | ||
var where = normalizeWhere(query.criteria.where); | ||
var where = normalizeWhere(query.criteria.where, query.meta); | ||
@@ -512,3 +512,3 @@ // Transform the stage-3 query sort array into an NeDB sort dictionary. | ||
// Normalize the stage-3 query criteria into NeDB (really, MongoDB) criteria. | ||
var where = normalizeWhere(query.criteria.where); | ||
var where = normalizeWhere(query.criteria.where, query.meta); | ||
@@ -617,3 +617,3 @@ // If the user is attempting to change the primary key, do a drop/add instead. | ||
// Normalize the stage-3 query criteria into NeDB (really, MongoDB) criteria. | ||
var where = normalizeWhere(query.criteria.where); | ||
var where = normalizeWhere(query.criteria.where, query.meta); | ||
@@ -709,3 +709,3 @@ // Remove the documents from the db. | ||
// Normalize the stage-3 query criteria into NeDB (really, MongoDB) criteria. | ||
var where = normalizeWhere(query.criteria.where); | ||
var where = normalizeWhere(query.criteria.where, query.meta); | ||
@@ -712,0 +712,0 @@ // Count the documents into the db. |
@@ -7,3 +7,3 @@ /** | ||
module.exports = function normalizeWhereClause (_whereClause) { | ||
module.exports = function normalizeWhereClause (_whereClause, meta) { | ||
@@ -83,3 +83,9 @@ // Clone the where clause so that we don't modify the original query object. | ||
case 'like': | ||
val['$regex'] = new RegExp('^'+_.escapeRegExp(modified).replace(/^%/, '.*').replace(/([^\\])%/g, '$1.*').replace(/\\%/g, '%')+'$'); | ||
let regexpAsString = '^'+_.escapeRegExp(modified).replace(/^%/, '.*').replace(/([^\\])%/g, '$1.*').replace(/\\%/g, '%')+'$'; | ||
if (meta && meta.makeLikeModifierCaseInsensitive) { | ||
val['$regex'] = new RegExp(regexpAsString, 'i'); | ||
} else { | ||
val['$regex'] = new RegExp(regexpAsString); | ||
} | ||
break; | ||
@@ -86,0 +92,0 @@ |
{ | ||
"name": "sails-disk", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Persistent local-disk (and/or memory) adapter for Sails.js / Waterline.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
57167
841