Don't understand: collection remove with undefined param filter?

I have the big problem with undefined param on collection remove filter.

// Method
removeData(params){
  Collection.remove({otherField: params}) 
  // It remove all doc, if param = undefined
  // I think that don't have any remove
}

Could clarify?

when you assign an object property with undefined variable, you will have an object without that property.
Then your command will be
Collection.remove({})

1 Like

Very thanks for your reply.
Now i checked in Meteor Guide :sunny:

As a safety measure, if selector is omitted (or is undefined ), no documents will be removed. Set selector to {} if you really want to remove all documents from your collection.

1 Like