0
ユーザ選択で得られたポリゴンデータ(lat-longs)をマップに挿入しようとしています。NodeJsとSequelizeを使用してMySQLテーブルにポリゴンデータを挿入する
マイsequelizeテーブルのフィールドがある -
"use strict";
var Sequelize = require("sequelize");
module.exports = function(sequelize, DataTypes) {
var MapData = sequelize.define("MapData ", {
mapDataId: {
type: DataTypes.INTEGER,
autoIncrement: true,
primaryKey : true
},
mySelection: {
type: 'Polygon',
allowNull: true
},
createdByUserId: {
type: DataTypes.INTEGER,
allowNull : false
},
createdDate: {
type: DataTypes.DATE,
allowNull : false
},
modifiedByUserId: {
type: DataTypes.INTEGER,
allowNull : false
},
modifiedDate: {
type: DataTypes.DATE,
allowNull : false
},
},
{
tableName:'MapData',
timestamps:false
});
return MapData ;
};
NodeJsサーバー・コードはこれがテーブルに挿入されません
create:function(mapData, creatorId){
mapData.createdDate = new Date();
mapData.modifiedDate = new Date();
mapData.createdByUserId = creatorId;
mapData.modifiedByUserId = creatorId;
mapData.mySelection = { type: 'Polygon', coordinates: [
[ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
[100.0, 1.0], [100.0, 0.0] ]
]};
MapData.create(mapData) }
です。私は続編の文書を参照しましたが、混乱していました。助けてください!