Mongodb order schema Design issues

see a shopping item in github. All user orders create a schema1 to store all user orders. User personal information creates schema2,schema2. In addition to basic information, there is a personal order: [] to store personal orders.

there is a question. Since all user orders are saved in schema1, users can check whether their own orders can be directly checked in schema1. If the amount of data is large, create an index in the order personal userID, so that users should quickly check their own orders, so it is not necessary to build oredr: [].
in addition, when querying according to the order number, mongodb generates a unique _ id, when creating the data. Whether you can use this _ id to do some processing as the order number.

Mar.30,2021

  • maybe this project has a so-called historical legacy , starting with schema2.order . Then there is schema1 .
  • is also the technical boss who wants to see if the Arrey subcollection paging query of mongo is useful.
  • Space for time. The database breaks TB easily.

the above is pure nonsense.

another: _ id can be directly used as an order id . The _ id generation algorithm of mongo is a distributed id generation algorithm. Timestamp + machine code + process Id+ random number

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9e83f-46463.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9e83f-46463.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?