method Query.prototype.select
Query.prototype.select(fieldNames: string | string[]): this

Retrieve only select properties from the matched entities.

Queries that select a subset of properties are called Projection Queries.

Examples

Example 1

const {Datastore} = require('@google-cloud/datastore');
const datastore = new Datastore();
const companyQuery = datastore.createQuery('Company');

// Only retrieve the name property.
const selectQuery = companyQuery.select('name');

// Only retrieve the name and size properties.
const selectQuery = companyQuery.select(['name', 'size']);

Parameters

fieldNames: string | string[]

Properties to return from the matched entities.

Return Type

this

See

Usage

import { Query } from ".";