Giter Club home page Giter Club logo

Comments (11)

garryshield avatar garryshield commented on June 3, 2024 4

'@typegoose/auto-increment' works

// user.module.ts
...
import AutoIncrementFactory from 'mongoose-sequence'
import { AutoIncrementID, AutoIncrementIDOptions } from '@typegoose/auto-increment'

@Module({
  imports: [
    MongooseModule.forFeatureAsync([
      {
        name: User.name,
        inject: [getConnectionToken()],
        useFactory: (connection: mongoose.Connection): ModelDefinition['schema'] => {
          const schema = UserSchema

          // const plugin = AutoIncrementFactory(connection)
          // schema.plugin(plugin, { inc_field: 'id', id: 'user_id'})

          schema.plugin(AutoIncrementID, { field: 'id' } as AutoIncrementIDOptions)

          return schema
        }
      }
    ])
  ],
  controllers: [UserController],
  providers: [UserService],
  exports: [UserService]
})
export class UserModule {}

or

// user.schema.ts
...
export const UserSchema = SchemaFactory.createForClass(User)
UserSchema.plugin(AutoIncrementID, { field: 'id' } as AutoIncrementIDOptions)
...

from mongoose-sequence.

Kozachokx avatar Kozachokx commented on June 3, 2024 3

Currently, the latest version of mongoose that works well is: 6.11.2
npm i [email protected]

from mongoose-sequence.

KiranCNayak avatar KiranCNayak commented on June 3, 2024 3

Currently, the latest version of mongoose that works well is: 6.11.2 npm i [email protected]

I put crazy amounts of console.log statements to see where I'm going wrong. You saved me another hour or two. Now it is working in 6.11.2. Thanks!

from mongoose-sequence.

Atitlanio avatar Atitlanio commented on June 3, 2024 1

why are you surprised people still use mongoose, is there a better solution for mongodb?

from mongoose-sequence.

ramiel avatar ramiel commented on June 3, 2024 1

Just to name a few:

but there are plenty

from mongoose-sequence.

garryshield avatar garryshield commented on June 3, 2024

Me too,after upgrade to [email protected]

from mongoose-sequence.

garryshield avatar garryshield commented on June 3, 2024

after some debug. [email protected] drop the callback supports for lots of model functions include findOneAndUpdate

[Dropped callback support](https://mongoosejs.com/docs/migrating_to_7.html#dropped-callback-support)

[this._counterModel.findOneAndUpdate(](

this._counterModel.findOneAndUpdate(
)

maybe it's time to find another solution.

from mongoose-sequence.

ramiel avatar ramiel commented on June 3, 2024

Hello everybody. Look, I have no more time to maintain this old library. Sometimes I'm also still impressed anybody keep using mongoose at all, but this is a free world ;) If anybody wants to take over is very welcome and I'm available to review PRs. For the moment I haver no time, no will to work on this library.

from mongoose-sequence.

edwardanthony avatar edwardanthony commented on June 3, 2024

@ramiel what about MongoDB itself? Are you dropping it as well?
Coming from SQL world, I'm also surprised that lookup performance on MongoDB is much worse compared to SQL.
And I only knew that after I have 30k+ records.
https://www.enterprisedb.com/blog/comparison-joins-mongodb-vs-postgresql

from mongoose-sequence.

amansingh63 avatar amansingh63 commented on June 3, 2024

Hello everybody. Look, I have no more time to maintain this old library. Sometimes I'm also still impressed anybody keep using mongoose at all, but this is a free world ;) If anybody wants to take over is very welcome and I'm available to review PRs. For the moment I haver no time, no will to work on this library.

@ramiel i had opened a PR for mongoose v7 migration please have a look, Thanks.
#136

from mongoose-sequence.

ramiel avatar ramiel commented on June 3, 2024

Version 6.0.0 released with the changes from #136 and now latest version of mongoose is supported

from mongoose-sequence.

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.