-
Type:
Bug
-
Resolution: Works as Designed
-
Priority:
Trivial - P5
-
None
-
Affects Version/s: 8.0.0
-
Component/s: None
-
None
-
Environment:Ubuntu 25, MongoDB 8, node 24, mongoDB NodeJS drivers 6.17.0
-
ALL
-
-
None
-
None
-
None
-
None
-
None
-
None
-
None
I'm trying to validate a date property against an `enum` within a JSONSchema.
here is the JSONSchema:
{
$jsonSchema: {
bsonType: 'object',
required: [
'birthDate',
'_id'
],
properties: {
birthDate: {
bsonType: 'date',
'enum': [
'1900-01-01T00:00:00.000Z',
'2000-01-01T00:00:00.000Z',
]
},
_id: {
bsonType: 'objectId'
}
},
additionalProperties: false
}
}
here is the validation error:
{
"failingDocumentId": "68543d9ec44bede24cdd1f9b",
"details": {
"operatorName": "$jsonSchema",
"schemaRulesNotSatisfied": [
{
"operatorName": "properties",
"propertiesNotSatisfied": [
{
"propertyName": "birthDate",
"details": [
{
"operatorName": "enum",
"specifiedAs": {
"enum": [
"1989-02-21T00:00:00.000Z",
"2000-01-01T00:00:00.000Z"
]
},
"reason": "value was not found in enum",
"consideredValue": "2000-01-01T00:00:00.000Z"
}
]
}
]
}
]
}
}
I've also tried to set the enum date as an epoch (integer) and a mongodb "json" date `
{"$date": "2000-01-01T00:00:00.000Z"}`.
None of these workarounds are working.