Created
October 31, 2012 17:29
-
-
Save pqwy/3988500 to your computer and use it in GitHub Desktop.
index occurrence ids
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
// nb. we have a typo with occurrences -- sometimes they are called "occurences". | |
var filter = {}; | |
var projection = { | |
_id : true, | |
facebook_occurence_ids : true | |
}; | |
db.movies.find(filter, projection) | |
.forEach(function (movie) { | |
var x = ( movie.facebook_occurence_ids || [] ).length; | |
db.movies.update( { _id: movie._id }, { '$set': { occurrence_count: x } } ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment