Skip to content

It is not possible to set retainKeyOrder option on Model#save() #1514

@bsrykt

Description

@bsrykt

For some cases I want to keep the key order of the data on insert. However this is not possible as Document#toObject() bypasses custom schema options when saving document:

  // When internally saving this document we always pass options,
  // bypassing the custom schema options.
  if (!(options && 'Object' == options.constructor.name)) {
    options = this.schema.options.toObject
      ? clone(this.schema.options.toObject)
      : {};
  }

I think it would be better to make it optional.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThis issue is a user-facing general improvement that doesn't fix a bug or add a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions