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.
Example 1
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']);