Question: I retrieve products by doing the following.

```
 Template.Bag.helpers({
    bagged_products: function () {
      var bag = Session.get("shoppingBag") || {};
      var bagged_product_ids = Object.keys(bag);
      var bagged_products = Products.find({_id: {$in: bagged_product_ids}});
      return bagged_products;
    }
  })

```

The dictionary `bag` is an array of `{"product_id": quantity}`. In the template, I also want to show each product's quantity. For example, I would do

```
for each retrieved_product p:
  p.qty = qty
return updated_products

```

The problem is that `bagged_products` is a `LocalCollection.Cursor` type and I don't know how to add a property to this, so I can do the following in a template.

```
        <div class="product-name">{{p_name}}</div>
        <div class="product-price">${{price}}</div>
        <div class="product-qty">{{my_added_qty}}</div>

```

Thank you!

Answer: 
You can use a transform in your helper:

```
var bag = Session.get("shoppingBag") || {}

var transform = function(product) {
    product.qty = bag[product._id] || 0;
    return product;
}

return Products.find({_id: {$in: bagged_product_ids}}, {transform: transform});

```

Then just use `{{qty}}` or anything else you name it in your #each block where you used `{{my_added_qty}}`
I ended up declaring a new local collection before returning the documents.

```
  Template.Bag.helpers({
    bagged_products: function () {
      var bag = Session.get("shoppingBag") || {};
      var tmpBag = new Mongo.Collection(null);
      for (var p_id in bag) {
        var p = Products.findOne({_id: p_id});
        p.qty = bag[p_id];
        tmpBag.insert(p);
      }
      return tmpBag.find();
    }
  })

```