btamas btamas - 9 months ago 72
PHP Question

How should I store an array in Google Datastore?

I am developing a PHP and Google Datastore based project management website, where a project can have multiple members as well. The members should be stored for a project, but I do not know, which is the best solution to do this. How can an array be stored in GDS?

Should I create a simple string, separated with ";" for example?

Or is it a better solution to make a separated Entity Kind list and store each member as a row? (as I counted it will do much more reads on the Datastore)

The number of the members is not fix, it can be from 0 to "unlimited".
I use Tom Walder's php-gdb library for GQL.

Tom Tom

Tom (php-gds author) here. Hope the library is working for you!

The answer is to use a "String List" - which is a specific data type in Datastore for storing arrays.

Some docs here on creating schemas

You need addStringList("members") Or something similar.

Are you using schemas already?