Untransform should treat Array's as nested objects (#1416)

This commit is contained in:
Blayne Chard
2016-04-08 09:43:48 +12:00
committed by Drew
parent 325d09ca4c
commit 616ac71623
2 changed files with 9 additions and 1 deletions

View File

@@ -147,6 +147,14 @@ describe('untransformObject', () => {
done();
});
it('nested array', (done) => {
var input = {arr: [{_testKey: 'testValue' }]};
var output = transform.untransformObject(dummySchema, null, input);
expect(Array.isArray(output.arr)).toEqual(true);
expect(output.arr).toEqual([{ _testKey: 'testValue'}]);
done();
});
});
describe('transformKey', () => {

View File

@@ -633,7 +633,7 @@ function untransformObject(schema, className, mongoObject, isNestedObject = fals
if (mongoObject instanceof Array) {
return mongoObject.map((o) => {
return untransformObject(schema, className, o);
return untransformObject(schema, className, o, true);
});
}