Skip to content

Cannot create field '-1' in element (mongoose 5.11.15) #9909

@gask

Description

@gask

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
I'm trying to save an object that was obtained by the function findOne using .select()after adding an element to an array field and it gives me the error in the title. This doesn't happen in version 5.8.7, but in 5.10.15 it started happening. I tested also in the latest version 5.11.15 and it still is happening.

If the current behavior is a bug, please provide the steps to reproduce.
https://gist.github.com/gask/cb1d3dfa25b31d3ef0a406a2a12724a0

What is the expected behavior?
Saving normally.

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
NPM 6.12.0
Node 12.13.0
Mongoose 5.10.15 (tested also in 5.11.15)
MongoDB 4.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugWe've confirmed this is a bug in Mongoose and will fix it.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions