Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 2.0

Couchbase Data modelling

2 replies [Last post]
  • Login or register to post comments
Sat, 01/14/2012 - 10:16
eggsy84
Offline
Joined: 01/14/2012
Groups: None

Hi there,

This question is not necessarily 2.0 develop preview specific however I think it may help people with the transition to the new Couchbase product.

I am looking for advice on data modelling. We are investigating Couchbase with a view to possibly using it for Realtime Analytics.

However I cannot find any documentation on how best to model real world data.

I shall propose a scenario and if the community could help me or discuss some ideas for how this could be modelled it would be very useful?

Note this is not representative of our product and I am not asking people to solve our modelling for us the question is more intended for discussion

Lets assume that customers make purchases of products at a particular date/time, products have information with them such as id, name, description and price, a purchase is performed on a date.

The initial requirement is to be able to count all purchases between two dates. For any 1 day there might be over 100,000 purchases - this is a pretty big business ;)

If any of the syntax is incorrect please let me know - all advice/help is welcome.

If we modelled the data something like so (which maybe completely incorrect):

Purchases with products

{
	"_id" : "purchase_1",
	"_rev" : "1-1212afdd126126128ae",
	"products" :  [
		"prod_1" : {
			"name" : "Milk",
			"desc" : "Semi-skimmed 1ltr",
			"price" : "0.89"
		},
		"prod_7568" : {
			"name" : "Crisps", 
			"desc" : "Salt and Vinegar",
			"price: "0.85"
		}
	]
	"date" : "2012-01-14 14:24:33"
}
 
{
	"_id" : "purchase_2",
	"_rev" : "1-1212afdd126126128ae",
	"products" :  [
		"prod_89001" : {
			"name" : "Bread", 
			"desc" : "White thick sliced",
			"price: "1.20"
		}
	]
	"date" : "2012-01-14 15:35:59"
}

So given that document layout we can see each purchase and we can see the products that were in that purchase - however how could we go about counting all the purchases between two dates? Also how could you see a log of all the purchases between two dates in date descending order?

Is this something Couchbase is suited for?

There might be hundreds of thousands of purchases between two dates and the customer doesn't like to wait for reports….as I'm sure everyone has experienced ;)

Would it be best to use the incr functions and if so how would you go about modelling the data?

Many thanks to anyone that reads this - I hope to expland on this further giving more examples of real world modelling problems if possible.

James

PS. I have also posted on Stackoverflow and shall share any answers for the forum.

http://stackoverflow.com/questions/8863862/couchbase-data-modelling-docu...

Top
  • Login or register to post comments
Mon, 01/16/2012 - 06:44
eggsy84
Offline
Joined: 01/14/2012
Groups: None

Hi all,

A helpful user on the Couchbase IRC channel has pointed me in the direction of the 'CouchConf' world tour pages.

There are a lot of presentations with videos and accompanying slides from each of the conferences.

http://www.couchbase.com/couchconf-world-tour

In particular the San Francisco one has a lot of supporting material.

http://www.couchbase.com/couchconf-sanfrancisco

Top
  • Login or register to post comments
Wed, 01/18/2012 - 03:49
eggsy84
Offline
Joined: 01/14/2012
Groups: None

A helpful user from Stackoverflow has posted an example:

http://stackoverflow.com/questions/8863862/couchbase-data-modelling-docu...

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker