Mongoose Schema for geoJson coordinates

前端 未结 3 2182
清歌不尽
清歌不尽 2021-02-09 00:43

I tried to create a schema for geojson but have had some problems with syntax for coordinates.

Here\'s my current code:

var DataSchema = new Schema({
           


        
3条回答
  •  梦毁少年i
    2021-02-09 01:26

    try this:

    var DataSchema = new Schema({
      properties: {
        title:       { type: String, required: true },
        description: { type: String, required: true },
        date:        { type:Date, default:Date.now }
      },
      geometry: {
           coordinates: {type: Array, required: true}
      }
    });
    

提交回复
热议问题