<commit_before>import Ember from 'ember';

export default Ember.Mixin.create({

  push(doc, expectedModelName, optional=true) {
    let ExpectedModelClass;
    if(expectedModelName) {
      ExpectedModelClass = this.modelClassForName(expectedModelName);
    }
    let internal = this._deserializeDocumentToInternalModel(doc, ExpectedModelClass, optional);
    if(!internal) {
      return;
    }
    return internal.getModel();
  }

});<commit_msg>database.push with opts and allow instantiate:false<commit_after>import Ember from 'ember';

const {
  merge
} = Ember;

export default Ember.Mixin.create({

  push(doc, opts) {
    opts = merge({ optional: true, instantiate: true }, opts);

    let ExpectedModelClass;
    if(opts.model) {
      ExpectedModelClass = this.modelClassForName(opts.model);
    }

    let internal = this._deserializeDocumentToInternalModel(doc, ExpectedModelClass, opts.optional);
    if(!internal) {
      return;
    }

    if(opts.instantiate) {
      return internal.getModel();
    } else {
      return { model: internal.modelName, id: internal.values.id, deleted: internal.state.isDeleted };
    }
  }

});
{'fraction_non_alphanumeric': 0.11471103327495621, 'fraction_numerical': 0.0, 'mean_word_length': 3.7037037037037037, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6488128', 'n_tokens_mistral': 351, 'n_tokens_neox': 343, 'n_words': 71}