Skip to content

Trying to implement mongoose sequence in type "module" es6 but it does not work  #137

Open
@simonpaul08

Description

@simonpaul08

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions