note
neilwatson
<p>There is not much more to show. Most is boring data manipulation that leads to the final array. The array holds only numbers. Nothing embedded.
<code>
my $conn = MongoDB::Connection->new;
my $db = $conn->mydb || die "$!";
my ($col, $cols, @cols, $q, $doc, @b, @c, @new, $x, $date, $l, $host);
@cols = $db->collection_names;
foreach $cols (@cols) {
</code>
<p>Above a loop through some collections and for each make the new array. Then I try to replace the array.
<code>
if ( @new > 1 ){
foreach my $xxx (@new){ print '@new = '.strftime('%Y-%m-%d', localtime($xxx))."\n"; }
$col->update(
{ "host" => $host },
{
'$set' => { "timestamp" => @new }
},
{ 'multiple' => 1, 'safe' => 1 }
) || die "$!";
</code>
<p>The foreach loop above is just to show there is data in @new. That works :). The update fails. The documentation for MongoDB is a bit sparse. I assume my syntax is wrong. Alas, I cannot figure how.
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-104468">
<p>
Neil Watson<br>
<a href="http://watson-wilson.ca">watson-wilson.ca</a>
</div></div>
989753
989864