FindOptions

db · /index·type

Controls how ShopService.findByDomain fetches and returns the document. Allows callers to skip shape conversion, include sensitive credentials, or request feature-flag population in a single call.

Properties

convert?
boolean
Whether to convert the result to the masked ``OnlineShop`` or keep the raw ``ShopBase`` doc.
populate?
string[]
Population paths (e.g. ``featureFlags.flag``). Inert on the Convex seam: the ``db/shops`` reads always resolve the ``shopFeatureFlags`` join, so ``featureFlags[].flag`` arrives populated whether or not this is passed. Retained for the frozen call-site signature.
projection?
Record<string, 0 | 1>
Field projection (e.g. ``{ domain: 1, 'i18n.defaultLocale': 1 }``) so callers that only read a couple of fields receive a narrow object. Include-style (``1``) paths are honored client-side; pair with ``convert: false`` as before.
sensitiveData?
boolean

Example

import type { FindOptions } from '@nordcom/commerce-db';
const opts: FindOptions = { populate: ['featureFlags.flag'] };
const shop = await Shop.findByDomain('acme.com', opts);

FeatureFlagService ReviewService ShopService FeatureFlagOption FeatureFlagRef ResolvedCartLineTokens ResolvedProductCardTokens ResolvedShopTheme

Metadata@nordcom/commerce-db@0.1.0Open in GitHub ↗

On this page