Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using onUpdate parameter on an entity embed object #2283

Closed
sawa-ko opened this issue Oct 17, 2021 · 2 comments
Closed

Error when using onUpdate parameter on an entity embed object #2283

sawa-ko opened this issue Oct 17, 2021 · 2 comments
Assignees

Comments

@sawa-ko
Copy link
Contributor

sawa-ko commented Oct 17, 2021

Describe the bug
I want to try to update the embedded object of an entity and when updating it, also update a value automatically with the onUpdate parameter, but mongodb throws an error when trying to do that.

Stack trace

2021-10-17 10:06:39 -  - previous MongoError: Updating the path 'embed.field' would create a conflict at 'embed'
2021-10-17 10:06:39 -  -     at Function.create (C:\Users\Kaname\Documents\Proyectos\Kaede\kaede-rewrite\node_modules\mongodb\lib\core\error.js:57:12)
2021-10-17 10:06:39 -  -     at toError (C:\Users\Kaname\Documents\Proyectos\Kaede\kaede-rewrite\node_modules\mongodb\lib\utils.js:123:22)
2021-10-17 10:06:39 -  -     at C:\Users\Kaname\Documents\Proyectos\Kaede\kaede-rewrite\node_modules\mongodb\lib\operations\common_functions.js:384:39
2021-10-17 10:06:39 -  -     at handler (C:\Users\Kaname\Documents\Proyectos\Kaede\kaede-rewrite\node_modules\mongodb\lib\core\sdam\topology.js:944:24)
2021-10-17 10:06:39 -  -     at C:\Users\Kaname\Documents\Proyectos\Kaede\kaede-rewrite\node_modules\mongodb\lib\cmap\connection_pool.js:350:13
2021-10-17 10:06:39 -  -     at handleOperationResult (C:\Users\Kaname\Documents\Proyectos\Kaede\kaede-rewrite\node_modules\mongodb\lib\core\sdam\server.js:558:5)
2021-10-17 10:06:39 -  -     at MessageStream.messageHandler (C:\Users\Kaname\Documents\Proyectos\Kaede\kaede-rewrite\node_modules\mongodb\lib\cmap\connection.js:277:5)
2021-10-17 10:06:39 -  -     at MessageStream.emit (node:events:390:28)
2021-10-17 10:06:39 -  -     at MessageStream.emit (node:domain:475:12)
2021-10-17 10:06:39 -  -     at processIncomingData (C:\Users\Kaname\Documents\Proyectos\Kaede\kaede-rewrite\node_modules\mongodb\lib\cmap\message_stream.js:144:12) {
2021-10-17 10:06:39 -  -   driver: true,
2021-10-17 10:06:39 -  -   index: 0,
2021-10-17 10:06:39 -  -   code: 40
2021-10-17 10:06:39 -  - }

To Reproduce
Steps to reproduce the behavior:

  1. Create a document
  2. Update embedded object field value
  3. See error

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Reproduction repo:
https://github.com/kaname-png/mikro-orm-error

Versions

Dependency Version
node v16.11.0
typescript 4.4.4
mikro-orm 4.5.9
your-driver mongo
@sawa-ko sawa-ko changed the title Error when using onUpdate decorator on an entity embed object Error when using onUpdate parameter on an entity embed object Oct 17, 2021
@sawa-ko
Copy link
Contributor Author

sawa-ko commented Nov 19, 2021

@B4nan Can you help me?
sorry for the ping

@B4nan
Copy link
Member

B4nan commented Nov 19, 2021

Well, this is not a bug, onCreate/onUpdate options on embeddables are simply not (yet) supported, especially with object mode. Embeddables support only a subset of the options.

@B4nan B4nan closed this as completed in 288899d Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants