0
是否可以設置什麼字段應該是「ID」字段?我確定我的方案有:jugglingdb - 設置主鍵字段
var Person = app.ormDb.define('person', {
id : { type: String, index: true, default: function() { return uuid.v4(); } },
oAuthID : { type: String, index: true },
name : { type: String },
gender : { type: String },
birth : { type: Date },
email : { type: String },
imageID : { type: String },
favorites : { type: JSON, default: function() { return {cars : [], animals : []}; } },
date : { type: Date, default: function() { return new Date(); } },
updated : { type: Date, default: function() { return new Date(); } }
});
和我的定義id
場MongoDB中顯示出來,但是當我用jugglingdb查找一個人Person.id返回值是MongoDB的_id的ObjectId值。所以我的id
被隱藏。