Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for keeping a specified amount of documents in GridFS instead of removing all or none #80

Merged
merged 3 commits into from Feb 16, 2012

Conversation

VvanGemert
Copy link
Contributor

A small enhancement for GridFS.open method.

The delete_old option removed all the old files while having a versioning system you might want to keep a limited set of files. This small little patch does that. You can specify a number of versions to keep by using the new versions option.

More information on why and how to use:
http://techblog.floorplanner.com/2011/12/28/mongodb-and-gridfs-versioning/

… removed the delete_old option.

The delete_old removed all the old files while having a versioning system you might want to keep a limited set of files. This small little patch does that. You can specify a number of versions to keep by using the new versions option.
@banker
Copy link
Contributor

banker commented Jan 6, 2012

This is a good idea, but a couple of notes:

  1. You cannot remove the :delete_old option altogether. Other users may be relying on it.
  2. Please include a test case and please document the method.

@VvanGemert
Copy link
Contributor Author

I've added back support for the :delete_old option, added a testcase and documented the option in the description of the method.

@banker
Copy link
Contributor

banker commented Feb 16, 2012

This looks good. Many thanks!

banker added a commit that referenced this pull request Feb 16, 2012
Allow GridFileSystem#delete to keep a specified number of versioned documents in GridFS rather than removing all or none.
@banker banker merged commit 0e50077 into mongodb:master Feb 16, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants