New to NoSQL/MongoDB and needing advice with schema

Hi @Mauricio_Ramirez ,

One alteration that you can do to the assignment document:

{
    "_id": ObjectId("5f4d0c1234f6b8d7e98a1234"),
currentBookTickets: [{
    "seriesStart": 1000,
    "seriesEnd": 1100,
    "availableQuantity": 10,
    "price" : 0.75
    "book": {
        "BookId": ObjectId("5f4d0c1234f6b8d7e98a1234")
   }},
{
    "seriesStart": 1100,
    "seriesEnd": 1200,
    "availableQuantity": 90,
    "price" : 0.25,
    "book": {
        "BookId": ObjectId("5f4d0c1234f6b8d7e98a1235")
   }}],
    "employeeDetails": {
        "_id": ObjectId("5f4d0c1234f6b8d7e98a1234"),
        "name": "John Doe"
    }
}

This way a specific person can have different series in an array of assigned bookings …

I recommend indexing predict like seriesStart and seriesEnd if you query by them as well as the user assigned (maybe even combined)

I recommend the following reading and courses for u

Ty

3 Likes