Mongodb order schema design problem

  mongodb, question

I saw a shopping item in github. all user orders created a schema1 to store all user orders. the user’s personal information created schema 2. besides the basic information, schema 2 also has a personal order:[] to store personal orders.

There is a doubt that since schema1 stores all user orders, it is also ok for users to check whether their orders are directly checked in schema1. if the data volume is large, an index is created in the personal userID of the order, so users should check their orders quickly. is it not necessary to build oredr:[].
In addition, when querying according to the order number, mongodb generates a unique _id when creating data. Can you use this _id to do some processing as the order number?

  • Maybe this project has so-calledproblem left over by historyFirstschema2.order. Another oneschema1.
  • He is also a technical boss who wants to try it out.mongoTheArreySub-set paging query is good or bad.
  • Space changes time. The database easily breaks TB.

The above is purely a lie. .

In addition:_idDirectly used for ordersidAlso can ah, itselfmongoThe_idGeneration algorithm is a distributed id generation algorithm. Time stamp+machine code+process Id+ random number