Data modelling for eCommerce website in MongoDB - database

I am building an e-commerce website for my client. I'm using MongoDB for storing data. But I'm pretty new to the concept of nosql.
In the site there will be couple of categories and under them products will came. Now I can't figure out how should I model my data.
Should I make a huge products collection and store product related documents in it and fetch them using tags?
Or should I make many small collection of categories and store similar category products in it?
Please, share how should I model products data and how can I get them efficiently.
And please Suggest your opinion if my approach is wrong.
Thanks.

Create a single schema and implement embedded data modeling in your schema. So keep the most common features in the outer-most layer, then add small fragments of specialized data clusters. For example:
Also please read the following articles to get more info:
1
2
Hope this helps.

Related

What database should I use for storing and analyzing blog post data warehouse? Relational vs No-SQL?

I plan to scrape blog posts from some sources and build a blog post data warehouse for analytics purpose. For example, listing the trending topics among millions of blog posts. I was wondering what type of database I should use for storing analyzing such big data. Relational or No-SQL? If No-SQL, which one?
I would appreciate your suggestions.
Because the analytics you plan on running depend on the words inside each article, that sounds like a use case that could be addressed nicely by Elasticsearch (NoSQL)

Create 2 documents when posting to CouchDB

Is this possible? I'd like to normalize some data I'm storing in CouchDB, to take in one JSON object and, through designdocs, create multiple documents with different pieces of the data.
An example would be posting data about a book. I'd like to create a document for the book, check and see if there's any information about a publisher and if we have a document for that publisher, and if we don't, create a document for the publisher as well.
Does CouchDB have any functionality that would accomplish this? I know I could split up the data on the client, but I'd rather this logic be more centralized.
You can post multiple docs at once with the bulk docs endpoint, but it doesn't contain any logic like you're describing. That must be done on the client.

Which NoSql for visualization extensive app

I am about to work on a app that will be showing a lot of visualizations. It is an data read-only application, there will be negligible write operations. We have a lot of data(JSON, CSV), depending on the usecase we will have to filter to a subset and send it to the UI for visualization.
What kind of NoSQL would you recommend and please do specify the reasons?Thanks!
P.S: Some of the devs are recommending ElasticSearch. I am not sure if we should go for a document store or a key-value in the first place.
If you're visualizing log data, I'd use logstash in combination with elasticsearch and kibana. There's also commercial ways to protect your data and more coming. I'm working on k3bana which will visualize data with X3DOM and D3.js. Good luck!
I used Redis (with Jedis) to store key-value pairs in one case.

Parent/Child key relationship design with app-engine data store

I am implementing a simple application for expenses reporting.The application will use GAE. In my application I have several entities (Classes) like Year, Month,Day, Expenses, Account and so on. The picture is as follow: a user can create an Account, then start to declare expenses with a simple form. The expenses are stored in GAE Datasotre. Every Year has Months, every month has Days and every day has a declared Expenses.the problem is that i don't know how to arrange theses entities in the non-relational database of GAE. I read several tutorial and articles from Google Developers website, but still don't understand the concept of Parent/child relationship and groups of entities. Anyone can help with some tutorial,video, articles or books on how to design the relationship and store your entities in a Non-relations database like GAE Data store. thanks in advance. I forget to mention that I would like to use GAE low-level data store.
If you are using java, I would suggest using objectify. It's just so much easier than JPA, for me at least.
You are paying by the read and write, so if for instance you can fit all of the data for a month in 1mb, then I would not have a separate entity for day. Anyway, I don't understand your requirements like why year has to be an entity and can just be a property that you filter by. I would actually think about just having a Day entity with Year, and Month properties to filter by.
http://code.google.com/p/objectify-appengine/wiki/IntroductionToObjectify#Relationships
In MongoDb you would have "embeded" documents. I dont know if GAE is as evolved as MongoDB - I suspect not. Perhaps you should look at another better documented NOSQL database if you are having problems with documetation at this stage. I'd have a look at the MongoDB site anyway, so if you ahve a background in SQL, you can see the mapping in terminology between the two cultures. Of course any NOSQL database is inherantly non transactional, so when the app develops to track expense payments, there may be some insuperable issues later.

What is best practice for working with DB in Wordpress?

I'm developing a plugin for Wordpress, and I need to store some information from a form into a table in the DB.
There are probably lots of pages explaining how to do this, this being one of them:
http://codex.wordpress.org/Function_Reference/wpdb_Class
But are there any other pages talking about best practice for interacting with th WP DB?
UPDATE
Found a few more pages which could be usefull:
http://wpengineer.com/wordpress-database-functions
http://blue-anvil.com/archives/wordpress-development-techniques-1-running-custom-queries-using-the-wpdb-class
Unless you need to create your own complex table structure I'd suggest using the existing tables for your needs. There's the options table, user meta table, and post meta table to work with. These all have built in apis for quick access.
Options: add_option(), get_option(), update_option(), delete_option()
Usermeta: add_user_meta(), get_user_meta(), update_user_meta(), delete_user_meta()
Postmeta: add_post_meta(), get_post_meta(), update_post_meta(), delete_post_meta()
I've not found much real need to go outside of these tables (yes, there are exceptions, I've done them myself when the data needs are complex) but these meta options all use a text field in the db to store the data, so there's a lot you can store here if its simple data.
If your data is simple then consider storing your information in one of these places as individual options or even as serialized arrays.
One of my BIGGEST pet peeves with plug in developers that leverage the WP database is that if/when a given database driven plugin isn't used anymore, the developer doesn't think to remove the footprint it made in the database.

Resources