Coder Social home page Coder Social logo

Comments (4)

Omegahorus avatar Omegahorus commented on July 20, 2024 1

I had some similar Problem with the mongoose. It didn't open the correct connection to the mongo-db and always told me to use not the default mongoose-Promise.

I fixed it with forwarding an existing mongoose model to typegoose.

new User().getModelForClass(User, { existingMongoose: mongoose });

and setting the correct promise (<any>mongoose).Promise = Promise; is only in my main-app file (where I also open the connection).

Hope this solves your problem.

from typegoose.

woxixiulayin avatar woxixiulayin commented on July 20, 2024

i got the same issue, that's because in node_modules/typegoose, it has its own mongoose dependence。in your code, mongoose is different from typegoose used from its own dependence.
you can delete the mongoose under node_modules/typegoose/node_modules to solve this.or use typegoose as local module, delete mongoose dependency. and do not put typegoose it in package.json.
this solution is not nice, i hope someone can fix this.
maybe can use moongose as a devDependence or peerDependence

from typegoose.

jakobwilkenson avatar jakobwilkenson commented on July 20, 2024

Yes, passing through the existing mongoose works! Unfortunately I immediately ran into other issues and decided that the benefit of removing redundancy wasn't worth the cost of having another library with it's own complexities and issues so I removed typegoose.

from typegoose.

EricRabil avatar EricRabil commented on July 20, 2024

This issue is caused by version conflicts between the version of mongoose that you require and the version of mongoose that typegoose requires. At the time of writing this, typegoose requires [email protected]. Running npm install [email protected] --save or yarn add [email protected] will resolve this issue (note: you may need to clear your node_modules folder after so that the version conflicts are fully resolved)

from 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.