Questions tagged [schema-design]

Concerned with design of properties and their hierarchy to represent an entity in a specific format. It can be JSON Schema, XML Schema, SQL Schema etc. Usually used to discuss database schemas.

142 questions
78
votes
7 answers

Using multiple PostgreSQL schemas with Rails models

I have a PostgreSQL database for my Rails application. In the schema named 'public' the main Rails models tables are stored etc. I have created a 'discogs' schema which will have tables with names that are sometimes the same as in the 'public'…
Johan
  • 1,897
  • 5
  • 23
  • 29
44
votes
5 answers

What are the [dis]advantages of using a key/value table over nullable columns or separate tables?

I'm upgrading a payment management system I created a while ago. It currently has one table for each payment type it can accept. It is limited to only being able to pay for one thing, which this upgrade is to alleviate. I've been asking for…
Taudris
  • 1,413
  • 1
  • 15
  • 23
40
votes
3 answers

Use more than one schema per collection on mongodb

I wanted to use more than one schema per collection in mongodb , how to use it....? It gives me this error when I try to run it: Error: OverwriteModelError: Cannot overwrite allUsers model once compiled. OverwriteModelError: Cannot overwrite…
TaLha Khan
  • 2,413
  • 2
  • 25
  • 39
23
votes
1 answer

How to implement a catalogue for meta-data and automating SQL in a database?

I have read here the discussions on 5NF, EAV and 6NF and the need for a catalogue to handle meta-data and the complex SQL "automatically". How is that implemented in practice? PerformanceDBA wrote several answers on 6NF and EAV that mentions…
15
votes
5 answers

When is referential integrity not appropriate?

I understand the need to have referential integrity for limiting specific values on entry or possibly preventing them from removal upon a request of deletion. However, I am unclear as to a valid use case which would exclude this mechanism from…
13
votes
3 answers

MongoDB Schema Design - Real-time Chat

I'm starting a project which I think will be particularly suited to MongoDB due to the speed and scalability it affords. The module I'm currently interested in is to do with real-time chat. If I was to do this in a traditional RDBMS I'd split it…
Nick
  • 6,967
  • 2
  • 34
  • 56
12
votes
1 answer

What is an efficient MongoDB schema design for a multilingual e-commerce site?

I'm designing a multilingual e-commerce site. Products have different properties. Some properties are different for each language (like color), other properties are the same for all languages (like SKU). Properties are not predefined, for example…
i.amniels
  • 1,781
  • 1
  • 25
  • 37
10
votes
2 answers

How to model many-to-many relationships in MongoDB (for a MySQL user)

I come from a MySQL background and am trying to wrap my head around MongoDB. In particular, I'm struggling to conceptualize how I should model n:n relationships the "Mongo way." For this example, let's say we have two collections: users and…
Josh Smith
  • 14,674
  • 18
  • 72
  • 118
10
votes
1 answer

enforce empty JSON schema

I want a JSON schema that enforces an empty JSON object, e.g. {} Is this a good idea and possible? I tried the following but it allows me to enter anything in the JSON body: { "description": "voice mail record", "type": "object", …
AwkwardCoder
  • 24,893
  • 27
  • 82
  • 152
9
votes
1 answer

How to add an element to WS-operation in consumer end for 1 provider when there's other providers?

I have authored a WSDL and the consumer/client that implements operation AddCar that has data for model and colour. Now one WS producer/server wants to also have data for length. I assume that other producers have difficulties to adapt to this…
char m
  • 7,840
  • 14
  • 68
  • 117
8
votes
4 answers

Mongoose variable key name

I have a mongo object and wish to access it via mongoose for my web app. The schema I've defined has an Object storing user ids and a 3-level value (yes, maybe or no). e.g. "user_info": { "": "y", "": "n" } The…
Simon Walker
  • 5,523
  • 6
  • 30
  • 32
7
votes
1 answer

How to design the schema for an author/user model in mongodb

I have looked through most of the mongodb schema design articles on mongo's website and most of the questions here on SO. There is still one use case which I haven't figured out. When looking at these tutorials, they usually reference the article…
rickharrison
  • 4,867
  • 4
  • 35
  • 40
7
votes
1 answer

How to reference json schema definition from another schema

I have a json schema representing a geometry as a Point or a MultiPoint. Each is defined within the schema in "definitions": { "$schema": "http://json-schema.org/draft-04/schema#", "id": "http://schema.my-site.org/geometry.json#", …
MojioMS
  • 1,583
  • 4
  • 17
  • 42
7
votes
1 answer

design of car booking application using elasticsearch

I need some help in designing car booking application. There is a document with information about car (title, model, brand, info, etc.) Problems I'm stuck with are: How to store available booking days? (I suppose I could use nested free date range…
Alex
  • 1,210
  • 8
  • 15
7
votes
1 answer

Recurring Events Schema w/ MongoDB

I've read some of the papers out there describing data storing methods for recurring events, but I'm still trying to wrap my head around the best practice, especially concerning MongoDB. My main concern is to cheaply retrieve all of the events that…
1
2 3
9 10