node.js - How do I delete a defined schema from Mongoose? -
i using node.js , mongoose interface mongodb. current implementation dynamically creates mongoose schemas during runtime. these schemas used create objects stored in respective collections in mongodb. @ point, delete function (express endpoint) might called deletes 1 or more of these collections , it's schema reference code (sets undefined). however, when go re-creating 1 of these schemas, mongoose complains old 1 exists!
any ideas?
try below make me understand if there same problam:
mongoose.connection.collections['yourcollectionname'].drop( function(err) { console.log('collection dropped'); });
Comments
Post a Comment