5

At the moment, when a user saves a page as favorite, I'm adding this info to the user profile. However now I want to retrieve the top 5 most saved pages.

I thought of just adding a field to the page that I could increment but every time I'd publish the page, this value would be overridden - Even if I wanted to save this value in both master and web, CD doesn't have access to master so they would be out of sync.

I also thought about extending xDB to include this info but not really sure how I can do this? Just create a facet on the contact?

I could check all the users' favorite pages but I imagine that it might be a better way of doing this?

EDIT Still looking for suggestions but for now I've just created a new collection in xDB just to store this data.

2 Answers 2

4

I think your solution to create a new collection in mongodb is a very viable solution. Then you can just query the collection to get the top 5 pages.

I would not recommend to put it in xDB as a custom facet because it would be "difficult" to get top 5 pages, as you would have to query every single contact to find the pages.

Even Sitecore does not do it like this, they aggregate the data from mongodb to MSSQL and then index it for speedy access from their analytics Experience Analytics.

If you want to have other related data, then you should create the data in MSSQL instead, so you can harness the power of relational data (foreign-keys and so forth).

1
  • I'll go with the collection. Thanks for the explanation - makes sense.
    – Snapper
    Mar 14, 2017 at 0:53
0

Storing such information directly in master DB is not a good idea. There are chances of being deadlocks when multiple users try to favorite same page at a time (or when saving the same item using multiple threads at same time).

xDB would be the best approach using custom Facets.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.