Skip to content

Instantly share code, notes, and snippets.

@jwulf
Created November 26, 2012 02:38
Show Gist options
  • Save jwulf/4146292 to your computer and use it in GitHub Desktop.
Save jwulf/4146292 to your computer and use it in GitHub Desktop.
attributes = meteor.Collection('attributes');
objects = meteor.Collection('objects');
// Local Collection only - no such Collection server-side
mergedView = meteor.Collection('merged');
allObjects = objects.find({});
for (myObject=0; myObject<allObjects.count)
{
myMergedView = mergedView.new();
myMergedView.objectID = objects.find({objectID: allObjects[myObject]});
myAttributes=attributes.find({object_id: allObjects[myObject]});
if (myAttributes.count > 0) {
// real pseudo-code
myMergedView.attributes = myAttributes[0].attributes
}
myMergedView.save();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment