Google datastore and materialized paths
3
votes
0
answers
122
views
Folks from MongoDB have documented a very nice approach of using a data model for tree-like structures: they call it *Materialized Paths *.
Consider following:
If I populate this hierarchy using following code:
db.categories.insert( { _id: "Books", path: null } )
db.categories.insert( { _id: "Programming", path: ",Books," } )
db.categories.insert( { _id: "Databases", path: ",Books,Programming," } )
db.categories.insert( { _id: "Languages", path: ",Books,Programming," } )
db.categories.insert( { _id: "MongoDB", path: ",Books,Programming,Databases," } )
db.categories.insert( { _id: "dbm", path: ",Books,Programming,Databases," } )
I can easily retrieve, for example, all descendants of *Programming*:
db.categories.find( { path: /,Programming,/ } )
Now I'm considering of moving this database into Google Cloud Datastore , but I'm concerned about how painful would be to perform queries for such filtering? Can someone provide an example?
If it's relevant, backend is written in Go.

Asked by Andrejs Cainikovs
(131 rep)
Oct 2, 2018, 02:41 PM
Last activity: Dec 21, 2021, 09:36 AM
Last activity: Dec 21, 2021, 09:36 AM