Hi,
I have an issue when i try to update via $set and the dot notation. If i put {skipSchema: true}, the update is done without problem.
the problem is present for releases 1.0.9/zod 3.x and 2.0.0/zod 3.x or 4.x .
Thanks.
The schema is the following:
const activityGpxSchema = z
.object({
GPX: z.object({
type: z.string(),
features: z.array(
z.object({
type: z.string(),
properties: z.object({
time: z.string(),
coordinateProperties: z.object({
times: z.array(z.string()),
heart: z.array(z.number()),
segments: z.array(
z.object({
index: z.number(),
highway: z.string().nullable(),
surface: z.string().nullable(),
tracktype: z.string().nullable(),
smoothness: z.string().nullable(),
})
)
.optional(),
}),
}),
geometry: z.object({
type: z.string(),
coordinates: z.array(z.array(z.number())),
}),
})
),
}),
isCorrectGpx: z.boolean(),
})
The update code:
await ActivitiesGPX.updateAsync(
{ _id: id },
{
$set: {
'GPX.features.0.geometry.coordinates': time_gps_data,
isCorrectGpx: true,
},
}
);
} catch (error) {
console.error(
'[updatePolylineCorrectGpsActivityGpx] - error: ',
error
);
}
The error.
W20250911-11:05:13.791(2)? (STDERR) [updatePolylineCorrectGpsActivityGpx] - error: ValidationError: Collection schema validation error [validation-error]
W20250911-11:05:13.792(2)? (STDERR) at new ValidationError (packages/pmogollons:zod-schema/src/ValidationError.js:20:5)
W20250911-11:05:13.792(2)? (STDERR) at Collection.Mongo.Collection.<computed> [as updateAsync] (packages/pmogollons:zod-schema/src/extendWithSchema.js:306:15)
W20250911-11:05:13.792(2)? (STDERR) at MethodInvocation.run (imports/api/methods/methods-activity.js:1713:33)
W20250911-11:05:13.793(2)? (STDERR) at processTicksAndRejections (node:internal/process/task_queues:105:5)
W20250911-11:05:13.793(2)? (STDERR) at Session.<anonymous> (packages/montiapm:agent/lib/hijack/wrap_session.js:77:18) {
W20250911-11:05:13.793(2)? (STDERR) isClientSafe: true,
W20250911-11:05:13.793(2)? (STDERR) error: 'validation-error',
W20250911-11:05:13.793(2)? (STDERR) reason: 'Collection schema validation error',
W20250911-11:05:13.793(2)? (STDERR) details: [
W20250911-11:05:13.793(2)? (STDERR) {
W20250911-11:05:13.793(2)? (STDERR) name: 'GPX.features.0.geometry.coordinates',
W20250911-11:05:13.794(2)? (STDERR) type: 'unrecognized_keys',
W20250911-11:05:13.794(2)? (STDERR) message: 'Unrecognized key: "GPX.features.0.geometry.coordinates"'
W20250911-11:05:13.794(2)? (STDERR) }
W20250911-11:05:13.794(2)? (STDERR) ],
W20250911-11:05:13.794(2)? (STDERR) errorType: 'Meteor.Error'
W20250911-11:05:13.795(2)? (STDERR) }
Hi,
I have an issue when i try to update via
$setand the dot notation. If i put {skipSchema: true}, the update is done without problem.the problem is present for releases
1.0.9/zod 3.xand2.0.0/zod 3.x or 4.x.Thanks.
The schema is the following:
The update code:
The error.