The source is a mongo collection of edge definitions like so:
{parent-id:"process0", child-id:"process1"}
{parent-id:"process0", child-id:"process2"}
{parent-id:"process1", child-id:"process4"}
{parent-id:"process2", child-id:"process5"}
For experimental sake, I wrote a small python script that constructs the
entire tree in memory (and makes some neat graphvis graphs). My goal now
is to write a REST api to traverse this graph. Sample URLS:
/processTree/ <-gives all root nodes
/processTree/process0 <-gives me all the children of process0
/processTree/process0/process1 <- gives me all the children of process1
What is the best way to model this tree data in Mongo?
Resolving the huge amounts of node is very slow, so I think that using
my preprocessed tree would be better. Currently, I have my data modeled
like so:
{ "_id" : ObjectId("..."),
"name" : "process0",
"children:" : [
{"children:" : [
{"children:" : [],
"name" : "process4"}
],
"name" : "process1"},
{"children:" : [],
"name" : "process2"}
],
},
{ "_id" : ObjectId("..."),
"name" : "process7"
"children:" : [
{"children:" : [],
"name" : "process8"}
],
}
However, I have found that trying to query this is tough. How do I get
all the children of process1?
I would prefer quick lookups, space does not matter at the moment.
Thoughts? Concerns? Political Commentary?
Thanks,
Jim
Out of curiosity are you pulling 1 doc at a time? If so perhaps resolving all docs using a server-side function might speed things up? If the bottleneck is roundtrips to the server it could help. If the bottleneck is already processing, well I probably just killed your server . ;-) -- You received this message because you are subscribed to the Google Groups "mongodb-user" group. To post to this group, send email to mongod...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en
-~----------~----~----~----~------~----~------~--~---