I need to build a system that will track our users in all of our websites.
Each new user coming to our website will be getting an ID that will be stored in a cookie.
On every activity in the site, we would like to save the relevant data.
for example, when a user register, we will expose an api for adding the activity to the database. later, we will make reporting back-end on the data.
We havn't yet decided on the technology, but we assume we will go for nodejs + express + mongoose.
We believe that the first collection (see bellow) will have around 6 million rows in a month. the other collections might have half of that.
I dont know if the following data structure will work good in mongodb.
SessionCollection
Id
mongo ObjectId - generated, will be the cookie Id eventually.Referer
- string (length of full query string uri)LandingUrl
- string (length of full query string uri)DateTime
Params
- KeyValue data, its the parsed data fromLandingUrl
, suppose to be a nested json tree.
if theLandingUrl
washttp://s.com?a=1&b=2&c=3
so the params will be :
params : {a:'1',b:'2',c:'3'}
ActivityCollection
Id
mongo ObjectIdSessionId
- "forein key" toSessionCollection
ActivityType
- Short free stringDateTime
ActivityData
- free KeyValue data (similar to the explanation above).
Both of the collection will be searchable in all fields, when I say all i mean all.
- Is this good structure for mongo?
- Do you recognize a bad pattern here?
- Do you have suggestions to make it better?
- Can a full url be indexed in mongodb?
thanks