This function performs an asynchronous request to the server to insert a new document of the specified
type into the database. The document is provided as a parameter and must adhere to the schema defined for
the document type in the system.
Example
// Insert a new 'Employee' document with specified fields. constnewEmployee: BareBoneDoc = { doctype:'Employee', name:'EMP-001', employee_name:'John Doe', designation:'Software Engineer', department:'Engineering', }; constinsertedEmployee = awaitinsertDoc(newEmployee); console.log(insertedEmployee); // Logs the newly inserted 'Employee' document
Example
// Add a new 'Product' document with details. constnewProduct: BareBoneDoc = { doctype:'Product', name:'PRD-123', product_name:'Laptop', price:999.99, stock:50, }; constinsertedProduct = awaitinsertDoc(newProduct); console.log(insertedProduct); // Logs the newly inserted 'Product' document
Example
// Create a new 'Order' document with order details. constnewOrder: BareBoneDoc = { doctype:'Order', name:'ORD-456', customer_name:'Alice Smith', order_date:'2024-09-08', total_amount:299.99, }; constinsertedOrder = awaitinsertDoc(newOrder); console.log(insertedOrder); // Logs the newly inserted 'Order' document
Throws
Throws an error if the request fails or if there is an issue with the document being inserted.
Inserts a new document into the database.
This function performs an asynchronous request to the server to insert a new document of the specified type into the database. The document is provided as a parameter and must adhere to the schema defined for the document type in the system.
Example
Example
Example
Throws
Throws an error if the request fails or if there is an issue with the document being inserted.