Coder Social home page Coder Social logo

Comments (5)

ramiel avatar ramiel commented on May 14, 2024 3

Starting from mongoose>4.7.9 looks like it's not possible anymore to change the schema after the model definition (see Automattic/mongoose#5203). This is true for plugins too, so if in your code you define the plugin before the model

const testSchema = new mongoose.Schema({
    test: String,
    order_id: Number
});
// The plugin
testSchema.plugin(sequence, {inc_field: 'order_id'});
// And then the model
const Test = mongoose.model('Test',testSchema);

it should work. Let me know

from mongoose-sequence.

ramiel avatar ramiel commented on May 14, 2024

I have tests passing with version 4.9.6
Please, can you provide some more information? What the error is exactly? How can I reproduce it?

from mongoose-sequence.

sergey-zero avatar sergey-zero commented on May 14, 2024

https://github.com/sergey-zero/example
objects don't have order_id field with 4.9.7 version of mongoose, but working fine on 4.7.9
maby i'm do something wrong
[ { _id: 5909717b8f1fde1b4f25e563, test: 'first', __v: 0 }, { _id: 590971f2f68e0e1bd036f5ce, test: '1aa55', __v: 0 }, { _id: 590971f7855a5a1bde32d665, test: '13352', __v: 0 }, { _id: 590973225934721d6f69125a, test: '111ce', __v: 0 } ]

from mongoose-sequence.

ramiel avatar ramiel commented on May 14, 2024

I'll have a look soon.

from mongoose-sequence.

sergey-zero avatar sergey-zero commented on May 14, 2024

Wow, you are GOD, it's really works. Thank you so much!!

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.