jagi / meteor-astronomy

Model layer for Meteor

Home Page:https://atmospherejs.com/jagi/astronomy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Upsert behavior question

kerf007 opened this issue · comments

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

@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