Skip to content
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

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

Open
sannminwin opened this issue Mar 17, 2022 · 0 comments
Open

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

sannminwin opened this issue Mar 17, 2022 · 0 comments

Comments

@sannminwin
Copy link

sannminwin commented Mar 17, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant