method Query.prototype.hasAncestor Query.prototype.hasAncestor(key: Key): this Filter a query by ancestors. Examples Example 1 const {Datastore} = require('@google-cloud/datastore'); const datastore = new Datastore(); const query = datastore.createQuery('MyKind'); const ancestoryQuery = query.hasAncestor(datastore.key(['Parent', 123])); Parameters key: Key Key object to filter by. Return Type this SeeDatastore Ancestor Filters