Skip to content

datastore: allow nested unindexed properties#2497

Merged
stephenplusplus merged 3 commits intogoogleapis:masterfrom
stephenplusplus:spp--1916
Aug 1, 2017
Merged

datastore: allow nested unindexed properties#2497
stephenplusplus merged 3 commits intogoogleapis:masterfrom
stephenplusplus:spp--1916

Conversation

@stephenplusplus
Copy link
Contributor

@stephenplusplus stephenplusplus commented Jul 28, 2017

Fixes #1916

To Dos

  • Docs
  • System tests
  • Unit tests

This will allow excluding embedded properties from indexing, using the solution discussed here. Here is the sample from our system tests:

datastore.save({
  key: datastore.key('Kind'),
  data: {
    longString: longString,
    notMetadata: true,
    metadata: {
      longString: longString,
      otherProperty: 'value',
      longStringArray: [
        {
          longString: longString,
          nestedLongStringArray: [
            {
              longString: longString,
              nestedProperty: true
            },
            {
              longString: longString
            }
          ]
        }
      ]
    }
  },
  excludeFromIndexes: [
    'longString',
    'metadata.longString',
    'metadata.longStringArray[].longString',
    'metadata.longStringArray[].nestedLongStringArray[].longString'
  ]
})

@stephenplusplus stephenplusplus added api: datastore Issues related to the Datastore API. status: do not merge labels Jul 28, 2017
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 28, 2017
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling ada4d67 on stephenplusplus:spp--1916 into 105f28b on GoogleCloudPlatform:master.

return entityProto;

function excludePathFromEntity(entity, path) {
var arrayIndex = path.indexOf('[]');

This comment was marked as spam.

This comment was marked as spam.

assert.ifError(err);

assert.deepEqual(entity, data);
assert.deepEqual(entity[datastore.KEY], postKey);

This comment was marked as spam.

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: datastore Issues related to the Datastore API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants