Basic document/bucket design questions for muti timezone/language/country sites
Having read most of the couchbase docs/white-papers I have still some basic questions on document/bucket design:
1) Storing timestamp/date values, which format do you recommend.
On the linux server I would define GMT timezone and display the date/time value according to the user's defined timezone.
I'm using java as a client so I would use a java.util.Date to store the value according to the user's timezone.
Because nosql is all about performance, should I store the timestamp (with milliseconds) as a long value or in a human readable value or maybe BOTH, using the long value for indexing/sorting and the human readable value when accessing the document from the console.
2) Designing document for multi-lingual sites
In a RDBMS, I would create one database, create separate tables for labels with a language key:
2.a. Entity with a lot of ids and many attributes, eg products:
- external table for the language dependent attributes
Product labels Table
PK: productId, languageId
2.b. Entity with few ids and few attributes, eg countries:
- all in one table
PK: countryId + languageId
In couchbase I could:
- create one bucket/database for language independent data
1 document per product
- create one bucket/database per language, language key is part of bucket name
In this last bucket:
1 document per product in that language (info changed by many users)
1 document for all countries in that language (table managed by site admins => few users => no concurrency problems)
With this set-up I would need 2 separate client connections, 1 for each bucket to retrieve a product and the language dependent data.
3) Couchbase having integrated CouchDb, can I use CouchDb best practices found on the net?
4) Please add a full-text search on the forums.
Before writing to a couchbase forum I would like to check if any similar question with answer exists before writing a new post :-)
Your help will be appreciated
0.How do you plan on searching for data Couchbase Views or ElasticSearch?
1. Use Zero GMT as you base time for all transactions + add user timezone.
this way all items time are the same and then you can also map/reduce by timezone.
In elasticSearch it likes a standerd time stamp of "Y-m-d H:m:s"
2.How many languages are you going to support? if 5 languages making 5 buckets is a good Idea, but you can to aggregate all your sales. if its 100 then add elements inside json doc about country or language is best. Also you can namespace your keys EX."en_","jp_". This way just prepend your GET()s.
Think of :
Couchbase Bucket = filing cabinet
doc = paper doc
"DocumentType":"Invoice" = doc type
"DocumentCategory":["",""] = folder(s)