Michael HolmesM
Convex Community3y ago
4 replies
Michael Holmes

Excluding fields in a query?

Is doing something like this the best way to remove fields or is there a way to do this directly in the query?

import { Doc } from '../../_generated/dataModel';

const removePrivateOrganizationData = (organizations: Doc<'organizations'>[]) => {
return organizations.forEach(org => {
delete org.monthlyStripeSubscriptionId;
delete org.yearlyStripeSubscriptionId;
delete org.isApproved;
delete org.evaluationCentsLimit;
delete org.generationCentsLimit;
delete org.paymentCentsBalance;
delete org.payoutCentsBalance;
delete org.isBanned;
delete org.lastEditorId;
});
};

export default removePrivateOrganizationData;
Was this page helpful?