Tell them which the problem is.
As you can see, I use the module node-twitter to collect all the tweets for a given user but I need to save every tweet or all the array, at a base data nosql as mongo. My code not work, it's wrong! i don't know , which is problem, thanks for you answers
var Twitter = require('twitter')
, mongoose = require('mongoose')
, db = mongoose.connect('mongodb://localhost:27017/tweets')
, tweetSchema = new db.Schema({
texto: new Array(),
}), util = require('util');
Twitter.get('/statuses/user_timeline/37503675.json', {include_entities:true}, function(data) {
var otro = new Array()
, test = db.model('tweetin', tweetSchema);
// iteration for all tweet in user id 37503675
for (var i = 0; i < data.length; i++) {
otro.push(util.inspect(data[i].text));
};
// create
var testtest = new test({
texto: otro
});
//save in mongo
testtest.save(function (err) {if (err) console.log ('Error on save!')});
//disconnected
// with db.disconnect(); or without
});