I am trying to use Mongoos to represent an organization between 3 schemas:
Schema1: {// fields} Schema 2: {// field} Scehma3: {// field - [Scehma1: Scehma2] - Collection of key-val elements where there is a referral for key schema 1 and Val scehma2} is the reference
Does this king of cohesion support the creation of a schema 4?
You can not create ambiguous keys in Mongoose because its entire purpose is to handle your document structure for you. What you can do, however, is to create an array of objects.
Schema 4: {schemaRefs: [{refToSchema1: {type: mongoose.Types.ObjectId, Ref: 'Schema1'}, Rifoschema 2 For future reference, when you use false names Instead of giving actual examples, it is very easy to understand your question: {{type: mongoose.Types.ObjectId, ref: 'schema 2'}}]}
Even here That if you prove your example wrong (for example restaurants and some relationships or something between customers), then it is very easy to understand the connection that you make Are trying.
No comments:
Post a Comment