Created
July 25, 2011 15:03
-
-
Save aheckmann/1104335 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
'pushing to an array of Mixed works': function () { | |
var db = start(); | |
mongoose.model('MySchema_', new Schema({ | |
arrays: [] | |
})); | |
var DooDad = db.model('MySchema_') | |
, doodad = new DooDad({ arrays: [] }) | |
, date = 1234567890; | |
doodad.arrays.push(["+10", "yup", date]); | |
doodad.save(function (err) { | |
should.strictEqual(err, null); | |
DooDad.findById(doodad._id, function (err, doodad) { | |
should.strictEqual(err, null); | |
doodad.arrays.toObject().should.eql([['+10','yup',date]]); | |
doodad.arrays.push(["another", 1]); | |
doodad.save(function (err) { | |
should.strictEqual(err, null); | |
DooDad.findById(doodad._id, function (err, doodad) { | |
should.strictEqual(err, null); | |
doodad | |
.arrays | |
.toObject() | |
.should.eql([['+10','yup',date], ["another", 1]]); | |
db.close(); | |
}); | |
}); | |
}) | |
}); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment