I
I
IDONTSUDO2019-06-04 07:26:30
MongoDB
IDONTSUDO, 2019-06-04 07:26:30

Mongose ​​how to properly organize data sending schema?

I have 2 collections of data. PRODUCT and ORDERS.
And they directly depend on each other , according to business logic. PRODUCT is what the business puts in the product list. And Orders is a list of orders . That is, orders are taken from PRODUCT. When I try to send an order with one request. Where two json strings are repeated. That is mongoose . Throws off only what is below . I highlighted this with a red line. How do I organize the ordering scheme like this. What would I order. Could send any number of products to the server?
-Nevertheless, I cannot
know how many products the business will eventually have.
Possible solutions I came up with...

On the front end, put everything in an array. And from there to get all the goods. Going through each, and sending. (crutch)


Draw a huge button for each order. Through which the order will be carried out. (crutch)

5cf5ef9f5abb8848343811.jpeg

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question