No collections to handle
Opened this issue · 2 comments
descholar-ceo commented
Hello, great package (by theory); I am saying by theory because that when I read docs, I am so interested in this package, however, I have taken advantage of it yet since after I followed all of the docs and read different issues on this repo, I am getting this message when I run seedgoose seed
=> No collections to handle
My model:
// user.schema-mongoose.ts file
export const User = new mongoose.Schema(
{
firstName: { type: String, trim: true, required: true },
otherName: { type: String, trim: true },
email: { type: String, unique: true, required: true },
phoneNumber: {
type: String,
unique: true,
minlength: [12, 'Must be only 12 digits'],
maxlength: [12, 'Must not exceed 12 digits'],
required: true,
},
address: {
name: String,
type: {
type: String,
enum: ['Point'],
required: true,
},
coordinates: {
type: [Number],
required: true,
},
},
isVerified: Boolean,
isDeletable: Boolean,
createdBy: Schema.Types.ObjectId,
password: String,
profilePictureUrl: String,
},
{ collection: 'user', versionKey: false },
);
User.plugin(schemaTimestaps);
export const USER_MODEL = 'USER_MODEL';
export const UserModel = mongoose.model(USER_MODEL, User);
The seed file:
// user.seed.json
{
"address": {
"type": "Point",
"name": "test",
"coordinates": [0, 0]
},
"email": "test@test.test",
"firstName": "test",
"otherName": "test",
"phoneNumber": "123456789012",
"profilePictureUrl": "",
"password": "",
"isDeletable": false,
"isVerified": false
}
The .seedgooserc.js
file:
require('dotenv').config();
var dbConnectionString = `mongodb://${process.env.DB_USER}:${
process.env.DB_PASSWORD
}@${process.env.DB_HOST.replace(/,\s*$/, '')}:${process.env.DB_PORT}/${
process.env.DB_NAME
}?retryWrites=true`;
module.exports = {
modelBaseDirectory: './app/',
models: '**/*.schema-mongoose.ts',
data: './app/seeds',
db: dbConnectionString
};
=> On running the seedgoose seed
this message appears: No collections to handle
, Note: user collection is present in the db
Seth-Reeise-education commented
I am receiving the same error
Seth-Reeise-education commented
Installing Seedgoose locally instead of globally, putting configuration into package.json instead of .seedgoosesrc.js and running "./node_modules/.bin/seedgoose seed" fixed the issue for me