Is there any way to save an array of JSON object to a mongodb with only one call? something like:
schemeObject.save(array_of_json_object, ca
How about something like this? I know it loops through the entire array.. dont ask me about the Big O for this.. probably not the best way to insert but works for just an initial data dump of some sort..
var arr = // array of objects;
res = [];
arr.forEach(function (item) {
item.save(function (err) {
res.push(err);
if (res.length === arr.length)
{
// Done
}
});
});