Insert: ignore key-value if undefined

Inserting a document seems to fail if a key’s value is undefined.

In the case below, what can I do to leave project out — but only if it’s value is undefined? In this case, I still want to insert a new document, but without the project key-value.

const projectName = undefined;

  name: picName,
  project: projectName

This is solved — Simple Schema was stopping the insert as a value for project was required. Adding the flag optional: true to the project field in the schema solved the problem. Sorry to waste your time.