David AlonsoD
Convex Community2y ago
3 replies
David Alonso

How to easily update a single nested field?

Why does the dynamic of updating a top level field not apply to nested fields?

For instance, why can't I do:
 await ctx.db.patch(doc._id, {
      // @ts-ignore
      "properties.queryType": "firestoreDocumentFieldFromPath",
    });


or this without having to spread the existing object
 await ctx.db.patch(doc._id, {
      // @ts-ignore
      properties: {
        // ...doc.properties,
        queryType: "firestoreDocumentFieldFromPath",
      },
    });
Was this page helpful?