Upsert behavior question
kerf007 opened this issue · comments
Eugene Kulakov commented
Hi, @lukejagodzinski!
I would like to understand whether this behavior is correct:
Let's say I have the created document in the collection:
{
_id: 'some id'
foo: 'bar'
}
For foo
, the scheme is defined as:
fields: {
foo: {
type: String,
default: 'default'
}
}
When I call the Upsert method: Class.upsert('some id', {})
It replaces the value for foo
from bar
to default
Although it seems to me that the existed value should be preserved
Łukasz Jagodziński commented
@kerf007 you're probably doing something wrong as I've tested it and it works as expected. You have to create minimal reproduction, so maybe you will track your error