rodrigogs / mongoose-timezone

Mongoose plugin to normalize stored dates timezone.
BSD 3-Clause "New" or "Revised" License
15 stars 6 forks source link

subDocument timezone problem #11

Open Zarinia opened 4 years ago

Zarinia commented 4 years ago

Hi, I have a problem my subDocument don't update to local timezone

{ 
    "prices" : [
        {
            "price" : {
                "USD" : NumberInt(10), 
            }, 
            "description" : {
                "en" : "test"
            }, 
            "createdAt" : ISODate("2020-05-11T05:39:34.435+0000"), 
            "updatedAt" : ISODate("2020-05-11T05:39:34.435+0000")
        }
    ], 
    "createdAt" : ISODate("2020-05-11T10:09:34.435+0000"), 
    "updatedAt" : ISODate("2020-05-11T10:09:34.435+0000"), 
    "__v" : NumberInt(0)
}

as you can see my createdAt in root and in prices.0.createdAt are different! my schema is :

const SchemaPrice = Schema({
    price: {
        type: Object,
        required: true,
    },
}, {_id: false, timestamps: true});
const schemaObject = {
    prices: [SchemaPrice]
};
const ModelSchema = new Schema(schemaObject,{timestamps: true});

what should i do?