-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
A. Nick Georgieff
committed
Nov 8, 2017
1 parent
bef3ba8
commit e72213d
Showing
21,108 changed files
with
74,641 additions
and
2,456,411 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env perl | ||
|
||
use MongoDB; | ||
use Data::Dumper; | ||
use v5.18; | ||
|
||
my $mongo = MongoDB->connect->db('scot-prod'); | ||
my $collection = $mongo->get_collection('entry'); | ||
my $cursor = $collection->find({class => "task"}); | ||
|
||
print "starting...\n"; | ||
print $cursor->count . " task records\n"; | ||
my %lookup = (); | ||
|
||
while (my $task = $cursor->next) { | ||
|
||
my $id = $task->{id}; | ||
print "...task $id\n"; | ||
|
||
my $meta = $task->{metadata}; | ||
|
||
if ( defined $meta ) { | ||
|
||
if ( defined $meta->{status} | ||
&& defined $meta->{when} | ||
&& defined $meta->{who} ) { | ||
|
||
say "... ... has valid task meta structure"; | ||
|
||
my $thref = { | ||
status => $meta->{status}, | ||
when => $meta->{when}, | ||
who => $meta->{who}, | ||
}; | ||
|
||
delete $meta->{status}; | ||
delete $meta->{when}; | ||
delete $meta->{who}; | ||
|
||
$meta->{task} = $thref; | ||
|
||
my $set = { | ||
metadata => $meta | ||
}; | ||
|
||
$collection->update_one( | ||
{id => $id}, | ||
{'$set' => $set } | ||
); | ||
say "Update == ".Dumper($set); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.