jeka-kiselyov / fastify-mongoose-api

Fastify plugin to expose API for Mongoose MongoDB models
https://fastify-mongoose-api-app.herokuapp.com/
MIT License
49 stars 7 forks source link

Add support for save/update with nested paths #10

Closed EmilianoBruni closed 1 year ago

EmilianoBruni commented 2 years ago

Patch to save/update documents with nested paths like

{ _id: '....', nested: {key1: val1, key2: val2, ...} ...

Works for whatever depth in path like

... nested: { nested1: { nested2 : { key1: val1 } } } ...

To save/update use ...nested.key1=newVal1&nested.key2=newVal2... or ...nested.nested1.nested2.key1=newVal1... in POST/PUT.

I was not able to create a test because tests for current module fails for this problem which I don't know how to solve (sorry I'm new to npm/nodejs)

jeka-kiselyov commented 1 year ago

Thank you for it @EmilianoBruni

I am not very active here, personal things, sorry for being slow. But merged now.

jeka-kiselyov commented 1 year ago

Will try to cover it with tests and publish on npm soon

jeka-kiselyov commented 1 year ago

Covered with https://github.com/jeka-kiselyov/fastify-mongoose-api/blob/master/test/nested_paths.test.js and published as 1.2.18