MongoDB schema pattern Performance

Viewed 25

i am not sure about which NoSQL MongoDB schema i should choose. let us say i have collection of patients and collection of doctors. each patient may subscribe for some doctors. should i store doctors ids inside patients collection or the opposite which is storing patients ids inside doctors collection, or both? basically i am asking about performance issue specially about the read. 1- doctor can see all info about their patients 2- patients can also see all info about their doctors

i have tried storing doctors ids inside patients collection because it is highly unlikely for a patient to subscribe for lot of doctors.

but the problem is that i think doctors will have some slowness because the system will try to filter doctor's id in every patient document, and precisely its array of ids in each patient document.

0 Answers
Related