Untransform should treat Array's as nested objects (#1416)
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user