coen-hyde/Shanty-Mongo — Issue #57: addToSet
Author: tonymillion
Created: 2011-12-12 18:08:06+00:00
State: open

Hi

I have a web app which has a tag cloud, all tags are converted to lower case and put in an array, eventually I'd like to execute code like:

{ $addToSet : { a : { $each : [ 'word1', 'word2', 'word3'] } } }

I have tried iterating over the array calling

$post->addToSet('tags', strtolower($value));

for each element, but it only ever sets the last one (and of course $each:[] does not work.

Is it possible to actually do this, and if not can it be added?