Open doronrk opened 2 years ago
@lorensr Just following up here. I can add unit tests and make changes, but wanted to first get your input on the high level approach before spending additional time.
Hey @doronrk, sorry for the wait—code looks good, tests sound good ☺️
@lorensr How does this look to you? This is fully backwards compatible. Code expecting mongoose documents to be returned from the
find...
methods will not break.toObject
is called only before serializing to the cache, not on the return value. When a document is deserialized from the cache,mongoose.Model.hydrate
is called on the result as well because the API expects a mongoose document in this case.Happy to address any feedback in the approach, let me know.