0

How can we remove a collection registered using keystone register method?

I tried to remove the model without success, then I tried manually using node console: But now even if I remove the collection using:

mongoose.connection.db.dropCollection('news', function(err, result) {console.log(err)});

my collection is automatically recreated somehow by keystonejs.

Any help would be appreciated.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Pierre
  • 3
  • 2
  • Why do you want to drop a whole model? That's application logic no? You can keep the collection just empty it out instead. – Harry Moreno Jan 13 '15 at 00:39
  • It appear in the admin interface automagically – Pierre Jan 13 '15 at 01:04
  • did you use a generator? If you want to remove a model remove `model.js` from the `models` directory. And wipe your db manually. – Harry Moreno Jan 13 '15 at 02:47
  • Thanks, it worked. I thought I tried that before, but my coffeescript watch must have regenerated the model before I flushed the database... – Pierre Jan 13 '15 at 03:28

1 Answers1

1

If you want to remove a model remove model.js from the models directory. And wipe your db manually.

Harry Moreno
  • 10,231
  • 7
  • 64
  • 116