Inserts multiple documents into the database in a single request.
This function performs an asynchronous request to the server to insert multiple documents of the specified type
into the database. The documents are provided as an array and must adhere to the schema defined for the document
type in the system. This is useful for batch processing when multiple documents need to be inserted at once.
Example
// Insert multiple 'Employee' documents in a single request. constemployees: BareBoneDoc[] = [ { doctype:'Employee', name:'EMP-001', employee_name:'John Doe', designation:'Software Engineer', department:'Engineering' }, { doctype:'Employee', name:'EMP-002', employee_name:'Jane Roe', designation:'Product Manager', department:'Product' }, ]; constemployeeIds = awaitinsertMany(employees); console.log(employeeIds); // Logs an array of identifiers for the newly inserted 'Employee' documents
Example
// Add multiple 'Product' documents at once. constproducts: BareBoneDoc[] = [ { doctype:'Product', name:'PRD-123', product_name:'Laptop', price:999.99, stock:50 }, { doctype:'Product', name:'PRD-124', product_name:'Mouse', price:25.99, stock:150 }, ]; constproductIds = awaitinsertMany(products); console.log(productIds); // Logs an array of identifiers for the newly inserted 'Product' documents
Example
// Create multiple 'Order' documents in one request. constorders: BareBoneDoc[] = [ { doctype:'Order', name:'ORD-456', customer_name:'Alice Smith', order_date:'2024-09-08', total_amount:299.99 }, { doctype:'Order', name:'ORD-457', customer_name:'Bob Johnson', order_date:'2024-09-09', total_amount:199.99 }, ]; constorderIds = awaitinsertMany(orders); console.log(orderIds); // Logs an array of identifiers for the newly inserted 'Order' documents
Throws
Throws an error if the request fails or if there is an issue with any of the documents being inserted.
Inserts multiple documents into the database in a single request.
This function performs an asynchronous request to the server to insert multiple documents of the specified type into the database. The documents are provided as an array and must adhere to the schema defined for the document type in the system. This is useful for batch processing when multiple documents need to be inserted at once.
Example
Example
Example
Throws
Throws an error if the request fails or if there is an issue with any of the documents being inserted.