These are chat archives for Automattic/mongoose

12th
Dec 2016
sarmauma11
@sarmauma11
Dec 12 2016 10:35
cansomeone tell me what is schema and why do we need to use it?
like in this code
var ZoneSchema = new mongoose.Schema({
  name:{},
  location:{},
  timestamp:{}

})

module.exports = mongoose.model("ZoneSchema",ZoneSchema)
we are creating a schema. But what it is doing and why we need it?
Christian Roy
@roychri
Dec 12 2016 14:51
@sarmauma11 MongoDB is actually "schemaless", but mongoose supports the concept of defining a "Schema". This allows you to say "which fields" are "allowed" in the collection (model) this is "tied" to, and which "type" of data may be contained. http://stackoverflow.com/questions/24668976/mongoose-behavior-and-schema