Mongmapper lets me easily create a new record as such
Track.create!({:name => "Obla di"})
Though I can't figure out how to insert more than one at a time as such
tracks = [{:name => "Obla di"}, {:name => "She Sang di"}]
Track.create!(tracks)
I know that I could just loop over the array and insert them one at a time but I would prefer to just do it in one line
The
.create!class method actually takes multiple args. It uses arbitrary arity instead of taking one array argument.You could do this, using the splat operator:
NB: As you can see from the code, this is just sugar. MongoMapper still makes one insert per document.