0

I'm using MongoEngine and have a model that I just updated. I want to delete the old version of the objects in mongodb and insert some entries using the new version of the Model. Currently with mongoengine it looks like I can only act on the collection if it matches a Mongoengine object. My code only ever has the current version of the Model.

Is there a way to delete a document (or drop a collection) using mongoengine if I don't have a matching Model?

Visitor Ryan
  • 13
  • 1
  • 2
  • This is not a really valid solution, but what about saving all objectids from your current model (the objects that match with your new version), and then just remove the items not in this list ? – Arount Jun 28 '17 at 14:46
  • Removing the item is the part I don't know how to do (or if it's possible with mongoengine). – Visitor Ryan Jun 28 '17 at 21:21

0 Answers0