Skip to content

Instantly share code, notes, and snippets.

@thesmith
Created April 19, 2011 17:55
Show Gist options
  • Save thesmith/929025 to your computer and use it in GitHub Desktop.
Save thesmith/929025 to your computer and use it in GitHub Desktop.
Find content in containers
var lookup = 'http://www.bbc.co.uk/programmes/p00fys8v';
var i=0;
var c=0;
var containers = db.content.find({lookup: lookup});
var found = null;
for (c=0; c<containers.length(); c++) {
var container = containers[c];
print("Currently processing "+container._id);
for (i=0; i<container.contents.length; i++) {
if (container.contents[i] != null && container.contents[i]._id == lookup) {
print("Found "+container.contents[i]._id);
found = container.contents[i];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment