Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 15th, 2012  |  syntax: None  |  size: 0.71 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. MongoDB and Perl: maintaining insert order
  2. use MongoDB;
  3. use MongoDB::Database;
  4. use MongoDB::OID;
  5.  
  6.  
  7. my $conn = MongoDB::Connection->new;
  8. my $db = $conn->test;
  9. my $users = $db->testlogwiki;
  10.  
  11.  
  12. $users->insert
  13. (
  14.    {
  15.      "product" => "WooHoo",
  16.      "errcode" => "WM2001_89873",
  17.      "solution1" => "Hit the computer.",
  18.      "line_text" => "Inserted in Perl too"
  19.    }
  20. );
  21.        
  22. "_id" : ObjectId("4fc62c2900ece6040c000000"),
  23. "solution1" : "Hit the computer.",
  24. "product" : "WooHoo",
  25. "errcode" : "WM2001_89873",
  26. "line_text" : "Inserted in Perl too"
  27.        
  28. $ perl -MData::Dumper -E 'my $foo = { one => 1, two => 2, three => 3 }; print Dumper($foo);'
  29. $VAR1 = {
  30.           'three' => 3,
  31.           'one' => 1,
  32.           'two' => 2
  33.         };