-2
{
    "_id" : ObjectId("56b84dab9f973b3cd5f52c8c"),
    "userid" : "abcde",
    "dates" : {
        "2-01-2015" : {
            "9-10" : {
                "ava" : "no",
                "bookibg_id" : "null"
            },
            "10-11" : {
                "ava" : "no",
                "bookibg_id" : "null"
            }
        },
        "3-01-2015" : {
            "9-10" : {
                "ava" : "no",
                "bookibg_id" : "null"
            },
            "10-11" : {
                "ava" : "no",
                "bookibg_id" : "null"
            }
        }
    }
}
{
    "_id" : ObjectId("56b84ed19f973b3cd5f52c8d"),
    "userid" : "abcde",
    "dates" : {
        "2-01-2015" : {
            "9-10" : {
                "ava" : "no",
                "bookibg_id" : "null"
            },
            "10-11" : {
                "ava" : "no",
                "bookibg_id" : "null"
            }
        },
        "3-01-2015" : {
            "9-10" : {
                "ava" : "no",
                "bookibg_id" : "null"
            },
            "10-11" : {
                "ava" : "no",
                "bookibg_id" : "null"
            }
        }
    }
}
{
    "_id" : ObjectId("56b84ed19f973b3cd5f52c8e"),
    "userid" : "abcde",
    "dates" : {
        "2-01-2015" : {
            "9-10" : {
                "ava" : "no",
                "bookibg_id" : "null"
            },
            "10-11" : {
                "ava" : "no",
                "bookibg_id" : "null"
            }
        },
        "3-01-2015" : {
            "9-10" : {
                "ava" : "no",
                "bookibg_id" : "null"
            },
            "10-11" : {
                "ava" : "no",
                "bookibg_id" : "null"
            }
        }
    }
}

したがって、これは単なる短いバージョンであり、多くの日付と時間帯があります。データベースを照会できるように、マングースでスキーマを定義したいと考えています。また、定義されたスキーマでは、特定の時間枠の場合、特定の日付の可用性を変更するクエリをどのように記述しますか?

4

1 に答える 1

0

千の唯一の可能な解決策..

var XY = new mongoose.Schema({
             userId: {type: String, required: true},
             dates: [{type: String, ref: 'Date' }]
 })

 var Date = new mongoose.Schema({
             timestamp: {type: Date, required: true},
             timeSlots: [{type: String, ref: 'TimeSlot'}]
 })

 var TimeSlot = new mongoose.Schema({
             startHour: {type: Number, required: true},
             endHour: {type: Number, required: true},
             ava: {type: String},
             bookibg_id: {type: String}
 })
于 2016-02-08T10:32:36.790 に答える