Skip to content

subDocument timezone problem #11

@Zarinia

Description

@Zarinia

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions