Best way to model "customers"

Hi there,

I'm setting up a DB for a typical e-commerce store and update N4J every night. It all comes down to this:

  • order -> store
  • order -> customer
  • orderline -> order
  • orderline -> product
  • product -> categorie

The problem i'm having is with the order -> customer. Ideally the customer is a logged-in customer and not a guest. If that is the case there is a customer_id in the order. If not I have almost all the data on the order itself. Only properties i'm missing is the created and updated fields.

I was thinking to create the customer based on the email from the order itself instead of the customers endpoint. Of course it could happend that users with an account update there email. One other thing I was considering: use customer_id if logged in and else email as the id, then the created and updated timestamps would be empty.

Any thoughts?

Remco

Would you expect to run queries on customer nodes or relationships? For instance, what products did customers order or in what categories or recommend other similar products? If that's the case, I wouldn't store the customer information on the order at all...instead, "merge" the customer_id from the order to a customer node.

That would be how I would go about it. :)