Here's how this went down for us. Write a little query to find the objects you want:
Inspect your results. Confirm that is totally the set of objects you want to blow to smithereens. Yes, yes it is. I feel totally confident (well, maybe slightly anxious, let's be honest now) in blowing away that results set.
Result: ALL the datapoint objects are destroyed!
Googling around suggests that a similar thing has been seen with Mongoid but I'm not seeing anything for Mongomapper. Eager to hear others' opinions on this issue, if you agree it's a bug, etc. Thanks!
I cannot reproduce this using MongoMapper 0.12.0 and a simple model that looks like
NoMethodError: undefined method `destroy_all' for #<Plucky::Query:0x007fa7d34c3b50>
This makes sense since Datapoints.where returns a Plucky::Query instance, which doesn't have a destroy_all method. Am I missing something here?
It does return that error but it has the side effect of first actually deleting everything in the collection! Sorry I didn't clarify that. We went into more detail here: http://blog.beeminder.com/mongo
Whoa! You're right. That's really bad.
Fixed in master.