Skip to content

insertMany

AGenson edited this page Mar 4, 2018 · 2 revisions

insertMany

Insert several entities into the table of the database


Parameters

Property Type Default Description
ctx Object required Will serve to call a service action: ctx.call
entities Array.<Object> required Entities to insert --> ex: [{ username: "user", age: 5 }, ...]

Return

Type: Promise

If the entities were inserted successfully :

// res = list of ids from entities inserted
Promise.resolve({
	name: "Operation Successful",
	message: `Inserts Done: ${res.length} element(s) inserted in table`,
	data: res
});

Else (an error occured) :

Promise.reject({ ... });

cf - details about errors

Clone this wiki locally