I have todo’s mongo schema like this:
const todoSchema = new Schema(
{
userId: { type: String, required: true },
title: { type: String, required: true },
due_date: {
date: { type: Number },
month: { type: Number },
year: { type: Number },
hours: { type: Number },
minute: { type: Number },
},
status: { type: String, required: true},
},
{ timestamps: true }
);
I wanna make graphql schema so I did like this:
const Todo = new GraphQLObjectType({
name: "Todo",
fields: () => ({
_id: { type: GraphQLID },
userId: { type: GraphQLString },
title: { type: GraphQLString },
due_date: { type: GraphQLString },
status: { type: GraphQLString },
})
});
So my question is what is the correct type for due date? In mongo I defined it as an object and how can I define the due_date as an object in graphql schema?