Created
September 22, 2015 22:10
-
-
Save yamadapc/9fffb15e163308cc273e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ONE_WEEK = 60 * 60 * 24 * 7 | |
function updateShortCycles(collection) { | |
var query = 'this.cycle && this.cycle.cycle_seconds < ' + ONE_WEEK; | |
print('Querying ' + collection + '"' + query + '"'); | |
collection.find(query).forEach(function(doc) { | |
print('Updating ' + collection + ' ' + doc._id); | |
collection.update( | |
{ _id: doc._id}, | |
{ $set : { "cycle.cycle_seconds" : '' + ONE_WEEK } } | |
); | |
}); | |
} | |
updateShortCycles(db.subscriptions); | |
updateShortCycles(db.offers); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment