|
@ -81,8 +81,9 @@ Collection.prototype.insert = function (docOrDocs, cb) { |
|
|
for (var i = 0; i < docs.length; i++) { |
|
|
for (var i = 0; i < docs.length; i++) { |
|
|
if (!docs[i]._id) docs[i]._id = oid() |
|
|
if (!docs[i]._id) docs[i]._id = oid() |
|
|
} |
|
|
} |
|
|
server.insert(self._fullColName(), docs, writeOpts, function (err) { |
|
|
server.insert(self._fullColName(), docs, writeOpts, function (err, res) { |
|
|
if (err) return cb(err) |
|
|
if (err) return cb(err) |
|
|
|
|
|
if (res && res.result && res.result.writeErrors && res.result.writeErrors.length > 0) return cb(res.result.writeErrors[0]) |
|
|
cb(null, docOrDocs) |
|
|
cb(null, docOrDocs) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|