Skip to content

Commit e209087

Browse files
Eduard Bosch BertranEduard Bosch Bertran
Eduard Bosch Bertran
authored and
Eduard Bosch Bertran
committed
feat: Add $regex test in $all array
1 parent 77580a0 commit e209087

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

spec/MongoTransform.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,18 @@ describe('parseObjectToMongoObjectForCreate', () => {
319319
expect(output.ts.iso).toEqual('2017-01-18T00:00:00.000Z');
320320
done();
321321
});
322+
323+
it('$regex in $all list', (done) => {
324+
var input = {
325+
arrayField: {'$all': [{$regex: '^\\Qone\\E'}, {$regex: '^\\Qtwo\\E'}, {$regex: '^\\Qthree\\E'}]},
326+
};
327+
var outputValue = {
328+
arrayField: {'$all': [/^\Qone\E/, /^\Qtwo\E/, /^\Qthree\E/]},
329+
};
330+
var output = transform.transformWhere(null, input);
331+
jequal(outputValue.arrayField, output.arrayField);
332+
done();
333+
});
322334
});
323335

324336
describe('transformUpdate', () => {

0 commit comments

Comments
 (0)