Skip to content

Getting Error: Cannot read property 'seq' of null #121

Open
@sannminwin

Description

@sannminwin

I have installed
"mongoose": "^5.11.12",
"mongoose-sequence": "^5.3.1",

and use mongoose-sequence in mongoose Model file as below

const mongoose = require("mongoose");
const AutoIncrement = require('mongoose-sequence')(mongoose);

const AlbumSchema = new mongoose.Schema({
userId: {
  type: Number,
},
title: {
  type: Object
},
genre: {
  type: Array
},
artists: {
  type: Array,
},
composers: {
  type: Array
},
releaseDate: {
  type: String
}
});

AlbumSchema.plugin(AutoIncrement, {inc_field: 'albumId'});

module.exports = mongoose.model('Album', AlbumSchema);

When I run Album.create(data) in controller I am getting this error

Screen Shot 2022-03-16 at 8 03 43 PM

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