Skip to content

Instantly share code, notes, and snippets.

@suissa
Created January 28, 2015 19:00
Show Gist options
  • Save suissa/dfae8fc6f62742ea6082 to your computer and use it in GitHub Desktop.
Save suissa/dfae8fc6f62742ea6082 to your computer and use it in GitHub Desktop.
linhaDoTempoSchemaExemploRuim
{hora: [
0: [{
tipo: {type: String, default: ''}
, idPublicacao: Schema.Types.ObjectId
}]
, 1: [{
tipo: {type: String, default: ''}
, idPublicacao: Schema.Types.ObjectId
}]
, 2: [{
tipo: {type: String, default: ''}
, idPublicacao: Schema.Types.ObjectId
}]
, 3: [{
tipo: {type: String, default: ''}
, idPublicacao: Schema.Types.ObjectId
}]
, 4: [{
tipo: {type: String, default: ''}
, idPublicacao: Schema.Types.ObjectId
}]
, 5: [{
tipo: {type: String, default: ''}
, idPublicacao: Schema.Types.ObjectId
}]
, 6: [{
tipo: {type: String, default: ''}
, idPublicacao: Schema.Types.ObjectId
}]
, 7: [{
tipo: {type: String, default: ''}
, idPublicacao: Schema.Types.ObjectId
}]
, 8: [{
tipo: {type: String, default: ''}
, idPublicacao: Schema.Types.ObjectId
}]
, 9: [{
tipo: {type: String, default: ''}
, idPublicacao: Schema.Types.ObjectId
}]
, 10: [{
tipo: {type: String, default: ''}
, idPublicacao: Schema.Types.ObjectId
}]
]}
@alanhoff
Copy link

pq não assim?

{
  hora: [
    [chave, valor],
    [0, [{...}]],
    [1, [{...}]],
    [2, [{...}]]
  ]
}

Btw, tem umas vírgulas perdidas na frente do teu código :P

@suissa
Copy link
Author

suissa commented Jan 28, 2015

Cago a indentação, pois olha vou testar aqui esse modelo, mas o "melhor" para mim seria:

hora: [
  0: [],
  1: []
]

@diogoriba
Copy link

Me perdi. Os exemplos com os arrays com chave:valor não são javascript válido, são? Ou estou perdendo alguma coisa?
O campo "hora" deveria ser um array associativo? Ou um objeto, talvez?

As perguntas podem ser bobas mas fiquei realmente sem entender :P
Abraço!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment