我正在使用此Node.js express应用程序
const db = mongoskin.db('mongodb://@localhost:27017/test')
const id = mongoskin.helper.toObjectIDPost方法
app.post('/collections/:collectionName', (req, res, next) => {
pino(req,res);
req.log.info('pino output');
req.collection.insert(req.body, {}, (e, results) => {
if (e) return next(e)
res.send(results.ops)
})
}).ops实际上是做什么的?
发布于 2020-04-22 15:05:46
我通过查看console.log(结果)找到了答案。
{
result: { ok: 1, n: 1 },
ops: [
{
name: 'richard',
email: 'ricard@gmail.com',
_id: 5e9feb03b73a9464635bc328
}
],
insertedCount: 1,
insertedIds: [ 5e9feb03b73a9464635bc328 ]
}我们将只向MongoDB发送ops元素。
https://stackoverflow.com/questions/61326645
复制相似问题