Remove undefined properties for create
See https://github.com/strongloop/loopback-connector-mongodb/issues/87
This commit is contained in:
parent
1f0f4b0f02
commit
9769df2c91
|
@ -231,7 +231,8 @@ DataAccessObject.create = function (data, callback) {
|
||||||
obj.trigger('save', function (saveDone) {
|
obj.trigger('save', function (saveDone) {
|
||||||
var _idName = idName(Model);
|
var _idName = idName(Model);
|
||||||
var modelName = Model.modelName;
|
var modelName = Model.modelName;
|
||||||
this._adapter().create(modelName, this.constructor._forDB(obj.toObject(true)), function (err, id, rev) {
|
var val = removeUndefined(obj.toObject(true));
|
||||||
|
this._adapter().create(modelName, this.constructor._forDB(val), function (err, id, rev) {
|
||||||
if (id) {
|
if (id) {
|
||||||
obj.__data[_idName] = id;
|
obj.__data[_idName] = id;
|
||||||
defineReadonlyProp(obj, _idName, id);
|
defineReadonlyProp(obj, _idName, id);
|
||||||
|
|
Loading…
Reference in New Issue