我想在node.js腳本中創建Dynamo數據庫表。有沒有類似於mongo.model()的東西;在DynamoDB中...?
總之,我想發電機-DB代碼等同於以下內容:
var mongo = require('mongoose');
var MongoDB = mongo.connect('mongodb://localhost:27017/test').connection;
MongoDB.on('error', function(err) { console.log(err.message); });
MongoDB.once('open', function() {
console.log("DynamoDB connection open");
});
var userschema = mongo.Schema({
\t name: String,
\t nickname: {type: String,default: ''},
\t email: String,
\t phone: String,
\t type: String,
\t port : String,
\t deviceRegId: {type: String,default: ''},
\t assignFlag: Number,
\t created: {type: Date,default: Date.now} \t ,
\t lastmsg : {type: String,default: ''} ,
\t lasttime : {type: Date,default: Date.now} ,
\t loginStatus : {type: Boolean,default: false} ,
\t isOnline : {type: Boolean,default: false} ,
\t chats: [{
\t \t \t from: String,
\t \t \t msgfrom: Number,
\t \t \t name: String,
\t \t \t msg: String,
\t \t \t date: {type: Date, default: Date.now},
\t \t \t flag: Number
\t }]
});
var agent = mongo.model('naveen', userschema);
exports.mongo = mongo;
exports.agent = agent;
我試圖尋找類似迪納摩功能,但找不到任何。任何幫助都會很有用。
如何dynamoose https://www.npmjs.com/package/dynamoose – Molda