Field selection
Using the fields parameter, you can specify exactly which fields you want to return from each record. This reduces the response payload and improves application performance.
Return specific fields
- Manta Studio
- PostgreSQL
TypeScript
// This example returns only the user's ID, first name, and last name.
const users = await manta.fetchAllRecords({
table: "users",
fields: ["user_id", "first_name", "last_name"],
page: 1,
list: 10,
});
TypeScript
// Return specific fields from an external PostgreSQL database
const users = await manta.fetchAllRecords({
db: "analytics_pg",
table: "users",
fields: ["user_id", "first_name", "last_name"],
page: 1,
list: 10,
});
Return all fields
If you omit the fields parameter, the method will return all fields from each record by default.
- Manta Studio
- PostgreSQL
TypeScript
const users = await manta.fetchAllRecords({
table: "users",
page: 1,
list: 10,
// No fields specified returns all fields
});
TypeScript
// Return all fields from an external PostgreSQL database
const users = await manta.fetchAllRecords({
db: "analytics_pg",
table: "users",
page: 1,
list: 10,
// No fields specified returns all fields
});