Created
November 12, 2014 15:04
-
-
Save wsmoak/31b79efedbbdfe2cdd61 to your computer and use it in GitHub Desktop.
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
I started with | |
{ :weight => 2.24, :count => 2, :date => to_utc(2014,11,10), :notes => "" } | |
then | |
{ :weight => 1.14, :date => to_utc(2014,11,10), :notes => "" } | |
{ :weight => 1.10, :date => to_utc(2014,11,10), :notes => "" } | |
But I only want one "thing" for each date, with the details stored inside. I tried: | |
litters.insert( | |
{:id => "43", :doe => "3BL", :buck => "C16", :birth_date => to_utc(2014,10,24), | |
:kindled => 2, :survived => 2, | |
:weights => [ | |
{ :date => to_utc(2014,11,10), | |
:avg_weight => 1.12, | |
:count => 2, | |
:data => [ | |
{ :weight => 1.14, :id => "", :notes => "" }, | |
{ :weight => 1.10, :id => "", :notes => "" } | |
] | |
} | |
] | |
} | |
) | |
But that gives: | |
load.rb:56: syntax error, unexpected {, expecting ']' | |
{ :weight => 1.10, :id => "", :notes => "" } | |
^ | |
load.rb:57: syntax error, unexpected ']', expecting end-of-input | |
The whole thing is here: https://github.com/wsmoak/nivens/blob/master/mongo-ruby/load.rb | |
Looking at http://www.json.org at the definition of an array ... what am I doing wrong? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment