I am trying to model a trading network where accounts can trade multiple items in single trade. I'd like to use neo4j to quickly be able to identify and visualize account behavior, and the movement of specific items
Our mongodb documents look somewhat like this
{
_id: 1233 // doc id
date: ISODate("2015-05-01T01:00:00"),
trade_id: 21312
account: 'joe'
to_account: 'tim'
items:
[
{ name: 'oil',count: '5' },
{ name: 'sunscreen', count: 1}
]
},
{
_id: 1234 // doc id
date: ISODate("2015-05-01T01:00:00"),
trade_id: 21312
account: 'tim'
to_account: 'joe'
items:
[
{ name: 'peas',count: '100' },
]
}
What would be the best structure for this within a neo4j database? I am struggling with how to best deal with the nature of the arrays as I'd like to be able to ask the db, to list me all accounts that have traded 'sunscreen' for 'peas'.
Thanks.