Is two mongodb tables, or mongoose tables, and then to achieve a one-to-many correspondence. How can this be achieved? Can you give me an example? I looked for a lot of documents and didn’t understand them. Thank you, great gods.
I don’t know what you want, but one-to-many doesn’t seem to conform to database logic. For example, if you take a field and the corresponding value is not one, how does the program know which value to return to you?
However, since you want to realize one-to-many in mongo, the key-value structure can realize similar functions. You can set the value as an array, so that a key can correspond to multiple values, the database returns an array, and you find the desired result in your code.