如何在环回中插入多个记录 [英] How to insert multiple records in loopback
本文介绍了如何在环回中插入多个记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收集了一个模型的记录.但是没有方法可以在Fireloop中插入Mongo db.
I have collection of records for a model. But there is no method available to insert into Mongo db in Fireloop.
有没有可用的方法?
推荐答案
是的,在您的models
创建端点中,请提供array
而不是object
Yes there is, in you models
create endpoint give an array
instead of object
示例:在Products
模型中
this.productApi.create(
[
{name: "Toy Car"},
{name: "Purse"},
{name: "Charger"}
]
).subscribe((res)=>console.log(res))
希望这会有所帮助.
这篇关于如何在环回中插入多个记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文