Giter VIP home page Giter VIP logo

Comments (1)

smolinari avatar smolinari commented on August 16, 2024 5

No one wants Promises,

Please speak for yourself. I want promises, where they make sense and that is in 99% of TypeScript/ JavaScript code being written. They are an integral part of Node/ JavaScript to make use of JavaScript's event loop in order to stop code from blocking processing.

it all came from functional javascripter's non fluent in Object Oriented modeling and closure camp's and I have seen whole companies bit the dust and go chapt 11 from their widespread impact of chaos async threads and inability to get any of it under control

Not using Promises in TypeScript/JavaScript won't make the code more object oriented. There is no such thing as "async threads" in JavaScript. In fact, Promises or async/ await code is exactly what makes JavaScript so simple to use. Much better than the old days where there were only callbacks.

instead of hardwiring everything onto promises and async/await.

Nothing is hardwired. It's how JavaScript works. Offering Observables is not going to make any JavaScript code more efficient or better.

Let's also take a step back. Observables are part of event management. i.e. certain objects can listen or produce events via working with observables. It's called reactive programming. It is a different paradigm than OOP, whereas OOP can make use of reactivity. What you are asking for is reactive features to Mongoose, which Mongoose itself doesn't support (maybe, more below). Remember, this package (nestjs-typegoose) is a wrapper to get Typegoose working in NestJS and Typegoose is a wrapper for Mongoose. If anything, you should be asking the Mongoose team for this change. And, I'll bet they'll basically ignore it.

Btw, there is a "bit" of reactive programming in Mongoose with "watching".

https://mongoosejs.com/docs/api.html#connection_Connection-watch
https://mongoosejs.com/docs/api.html#model_Model.watch

Or with their hooks system within Middleware:

https://mongoosejs.com/docs/middleware.html

Your ask here is incorrectly placed as mentioned above. And, also instead of thinking you know the solution is to work with Observables, you might want to go to a place like StackOverflow/ StackExchange and present your current challenge and hopefully get people with a lot of knowledge to reply. I'll bet you a beer, they don't end up with saying some package will need to change and offer Observables to solve your problem.

Scott

from nestjs-typegoose.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.