I am creating an application that uses the UID of a mobile device as one of the means of authenticating sessions to the parent model. My intention to be a user can be authenticated for several parents, but has only one session record in the database for each parent.
ParentSchema {
sessions: [{
device_uid: { type: String, unique: true }
}]
}
A session is its own schema object (written inline for simplicity).
My question is: if I put a unique check on device_uid, is the sub-document check context for the parent IT element or ALL session sub-headers for ALL parents?
source
share