mongoose-timezone icon indicating copy to clipboard operation
mongoose-timezone copied to clipboard

subDocument timezone problem

Open Zarinia opened this issue 5 years ago • 0 comments

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?

Zarinia avatar May 11 '20 05:05 Zarinia