I have 2 collections all_files and trashed_files. File item object in each of these collections is the same { name, type, metadata }
. Is it a good idea to create only one collection with one boolean property isTrashed in the file item object like { name, type, metadata, isTrashed }
and delete the trashed_files collection?
Currently to delete the file item, I have first delete item from all_files collection and add it to trashed_files collection. Although mongo operations are atomic, this requires two operations. With the new schema I will only have to update isTrashed property for the concerned file item. But my worry is that for a very large collection this will lead to slow performance when I want to find all trashed files from the all_files collection.
Which schema is better? I have read about single/multi table inheritance and denormalized nature of the mongodb.