googleapis / googleapis/google-cloud-node

Support retrieving and editing excludeFromIndexes (parity with other client libraries)

Open
#7,155 2 comments 2 reactions 1 assignee Claimed by @danieljbruce View on GitHub
api: datastore library: datastore priority: p2 type: feature request
Dominant language
TypeScript
Stars
3.2k
Forks
712
Avg merge
2d 3h
Merged PRs (30d)
99

Description

**Is your feature request related to a problem? Please describe.**
There is no way to get/set which fields of an entity are indexed after initial entity creation.

Use case:
1) Retrieve an entity
2) Add a new field to the entity
3) Exclude the new field from being indexed

Unlike the other client libraries, there is no way to achieve this with Node JS.

**Describe the solution you'd like**
Here's example code from the PHP Datastore library which easily enables this use case:
```
$ds = Datastore::get();
$entity = $ds->lookup($ds->key(...));
$entity["newField"] = 123;
$unindexedFields = $entity->excludedProperties(); // Get the unindexed fields.
$unindexedFields[] = "newField"; // Prevent the new field from being indexed.
$entity->setExcludeFromIndexes($unindexedFields);
$ds->update($entity);
```

**Describe alternatives you've considered**
Without this functionality, we cannot use Node JS or this library for our project.

**Additional context**
Related requests from other customers:
https://github.com/googleapis/nodejs-datastore/issues/914
https://github.com/googleapis/google-cloud-node/issues/7156

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.