Didas-git / Nekdis

Redis-OM proposal for improvements on the interface
MIT License
10 stars 0 forks source link

[Suggestion] model.createAndSave should return Document, and should support nested stuff #1

Closed dxgi closed 1 year ago

dxgi commented 1 year ago

image

I think the model.createAndSave method should at least return the Document.

The model and document should be able to handle nested objects, and array of nested objects.

This is how I implemented mine: https://github.com/dxgi/typesafe https://github.com/dxgi/typesafe/blob/master/src/test/index.ts

Didas-git commented 1 year ago

I will think about the benefits of returning the document itself as for now im focusing on finishing the search functionality.

About nested objects, they should already be supported everywhere (even on search), if the problem is whithin the types not showing them, then i made a mistake when i was remaking them. About supporting array of objects im still searching for possible solutions, curretly the problem is that i havent found a way to implement it properly on RediSearch without some hacky solution (like creating a new key for them)

dxgi commented 1 year ago

Alright, Looking forward to this! :D

Didas-git commented 1 year ago

After some thought i will not implement this since it can lead to data not being in sync with the database, however i will allow the create method to accept an object with the data just like createAndSave so it is more intuitive to work.