googleapis / googleapis/google-cloud-node
Support retrieving and editing excludeFromIndexes (parity with other client libraries)
- 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
Assessment
This issue has not been assessed yet.