@@ -60,7 +60,39 @@ key for key. A managed runtime binds `services.data` to this same shape.
6060- ` object ` : short object name (for example ` task ` , ` account ` )
6161- ` id ` : record ID for single-record operations
6262- ` data ` : partial payload for create/update
63- - ` options ` ( ` find ` ): filters, sorting, pagination ( ` top ` , ` skip ` , ` filter ` , ` sort ` , ` select ` )
63+ - ` options ` ( ` find ` ): filtering, sorting and pagination — two vocabularies, one
64+ behaviour; see the table below
65+
66+ ### ` find ` options: canonical and legacy
67+
68+ The signature above accepts ` QueryOptions | QueryOptionsV2 ` , and the Canonical source
69+ declares which of the two to write. ` QueryOptionsV2 ` is *"canonical query options using
70+ Spec protocol field names … the recommended interface for ` data .find ()` queries"*, while
71+ ` QueryOptions ` carries an ` @deprecated ` tag in the same file describing *"legacy parameter
72+ names … that require translation to QueryAST"*, with the instruction to *"prefer QueryAST
73+ fields directly"*. Both interfaces are declared in ` packages /client /src /index .ts ` , so the
74+ recommendation is the SDK's own, not this page's.
75+
76+ | Canonical ( ` QueryOptionsV2 ` ) | Legacy ( ` QueryOptions ` ) | Clause |
77+ |:---|:---|:---|
78+ | ` where ` | ` filter ` | filter conditions ( ` WHERE ` ) |
79+ | ` fields ` | ` select ` | field selection ( ` SELECT ` ) |
80+ | ` orderBy ` | ` sort ` | sort definition ( ` ORDER BY ` ) |
81+ | ` limit ` | ` top ` | maximum records ( ` LIMIT ` ) |
82+ | ` offset ` | ` skip ` | records skipped ( ` OFFSET ` ) |
83+
84+ **Write the left column.** Those are the QueryAST and protocol field names, so the same
85+ words carry from here down through ` data .query ()` into the query layer — one translation
86+ step fewer to hold in your head.
87+
88+ **The right column still works.** Nothing refuses it: ` find ` recognises a canonical
89+ options object and normalizes it into exactly the transport parameters the legacy names
90+ produce, so the two columns are equivalent, not merely similar. Deprecated here means
91+ "prefer the other spelling", not "scheduled for removal in this version".
92+
93+ **Use one column per call.** ` find ` reads either the canonical names or the legacy ones
94+ for a given options object, never a blend — a key from the other column is dropped
95+ silently rather than refused, so migrate an options object as a whole.
6496
6597## Returns
6698
@@ -93,11 +125,12 @@ export async function recentOrdersForContact(data: DataService, contactId: strin
93125 // `get` resolves the response envelope `{ object, id, record }` — the row is `record`.
94126 const { record : contact } = await data .get <{ id: string ; name: string }>(' contact' , contactId );
95127
96- // `find` resolves `{ records, total?, hasMore? }`.
128+ // `find` resolves `{ records, total?, hasMore? }`. The options are the canonical
129+ // `QueryOptionsV2` vocabulary — `where` / `orderBy` / `limit`, not `filter` / `sort` / `top`.
97130 const { records : orders } = await data .find <{ id: string ; amount: number }>(' sales_order' , {
98- filter : { contact_id: contact .id },
99- sort : [{ field: ' created_at' , order: ' desc' }],
100- top : 20 ,
131+ where : { contact_id: contact .id },
132+ orderBy : [{ field: ' created_at' , order: ' desc' }],
133+ limit : 20 ,
101134 });
102135
103136 return { contact , orders };
0 commit comments