Merge pull request #567 from IlyaDiallo/master

Accept subdocuments keys ("object.subobject"), to allow atomic updates of an object field.
This commit is contained in:
Fosco Marotto
2016-02-26 02:05:03 -08:00
3 changed files with 50 additions and 1 deletions

View File

@@ -29,6 +29,17 @@ describe('Schema', () => {
});
});
it('can validate one object with dot notation', (done) => {
config.database.loadSchema().then((schema) => {
return schema.validateObject('TestObjectWithSubDoc', {x: false, y: 'YY', z: 1, 'aObject.k1': 'newValue'});
}).then((schema) => {
done();
}, (error) => {
fail(error);
done();
});
});
it('can validate two objects in a row', (done) => {
config.database.loadSchema().then((schema) => {
return schema.validateObject('Foo', {x: true, y: 'yyy', z: 0});