Skip to content

Graph Factory Flags

Markus Sabadello edited this page Jul 4, 2014 · 12 revisions
  • hashIdentifierFlag (default false)

  • If true, the graph identifiers will be hashed before being used on the Mongo layer.

  • If false, the plain graph identifiers will be used on the Mongo layer.

  • sharedDatabaseFlag (default true):

  • If true, all graphs will be stored in a single Mongo database. The name of the Mongo database is "xdi2graph". The Mongo database contains a single "contexts" collection. Every entry in the collection contains an "id" field, which is the graph identifier, and a "key" field, which is the XDI address of the context. The index in the collection is the "_id" field, which is a combination of the "id" and "key" fields.

  • If false, every graph will be stored in its own Mongo database. The name of the Mongo database is the graph identifier. The Mongo database contains a single "contexts" collection. The index in the collection is the "_id" field, which is the XDI address of the context.

Examples

Mongo data if hashIdentifierFlag=false and sharedDatabaseFlag=true (default):

> show dbs
local	0.078125GB
xdi2graph	0.203125GB
> use xdi2graph
switched to db xdi2graph
> db.contexts.find()
{ "_id" : ObjectId("53b5b02f716ff80c9b0abdb0"), "" : [  "&" ], "id" : "([=]!:uuid:1111)", "key" : "=markus<#email>" }
{ "" : [  "=markus",  "=drummond" ], "_id" : ObjectId("53b5b02f716ff80c9b0abdae"), "id" : "([=]!:uuid:1111)", "key" : "" }
{ "_id" : ObjectId("53b5b02f716ff80c9b0abdb2"), "/#friend" : [  "=markus" ], "id" : "([=]!:uuid:1111)", "key" : "=drummond" }
{ "_id" : ObjectId("53b5b02f716ff80c9b0abdb1"), "&" : "markus.sabadello@gmail.com", "id" : "([=]!:uuid:1111)", "key" : "=markus<#email>&" }
{ "" : [  "<#email>" ], "#friend" : [  "=drummond" ], "_id" : ObjectId("53b5b02f716ff80c9b0abdaf"), "id" : "([=]!:uuid:1111)", "key" : "=markus" }

Mongo data if hashIdentifierFlag=true and sharedDatabaseFlag=false:

> show dbs
local	0.078125GB
pUmimdqnJXStvidozNWC1_RQxlO7pvm9uow3uvSz0wE	0.203125GB
> use pUmimdqnJXStvidozNWC1_RQxlO7pvm9uow3uvSz0wE
switched to db pUmimdqnJXStvidozNWC1_RQxlO7pvm9uow3uvSz0wE
> db.contexts.find()
{ "/#friend" : [  "=markus" ], "_id" : "=drummond" }
{ "" : [  "&" ], "_id" : "=markus<#email>" }
{ "&" : "markus.sabadello@gmail.com", "_id" : "=markus<#email>&" }
{ "" : [  "=markus",  "=drummond" ], "_id" : "" }
{ "" : [  "<#email>" ], "#friend" : [  "=drummond" ], "_id" : "=markus" }
Clone this wiki locally