-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to implement mongoose sequence in type "module" es6 but it does not work #137
Comments
Facing same issue here and I just wanted to know if you figured something out? |
You're facing the same issue, but what's the issue exactly? |
still getting the same error, no solution yet. It could be because of the type "module" but I am not sure |
Can you please report the exact error? In your initial report there is only the code, not the error. Otherwsie, can you make a reproduction? |
It has error: Argument of type 'typeof import("mongoose")' is not assignable to parameter of type 'Schema<any, Model<any, any, any, any, any, any>, {}, {}, {}, {}, DefaultSchemaOptions, { [x: string]: unknown; }, Document<unknown, {}, FlatRecord<{ [x: string]: unknown; }>> & FlatRecord<...> & Required<...>>'. |
This is the code for the Schema =>
import mongoose, { Schema } from "mongoose";
import Inc from 'mongoose-sequence';
const AutoIncrement = Inc(mongoose);
const noteSchema = new Schema(
{
user: {
type: mongoose.Schema.Types.ObjectId,
required: true,
ref: 'User'
},
title: {
type: String,
required: true
},
text: {
type: String,
required: true
},
completed: {
type: Boolean,
default: false
}
},
{
timestamps: true
}
)
noteSchema.plugin(AutoIncrement, {
inc_field: "ticket",
id: "ticketNums",
start_seq: 500
});
export default mongoose.model('Note', noteSchema);
do let me know what am I doing wrong..
The text was updated successfully, but these errors were encountered: