<commit_before>'use strict';

import mongoose from 'mongoose';

import Tweet from '../models/tweet';

class Database {
	static initialize(config) {
		let self = this;

		mongoose.connect('mongodb://localhost/twitter-archiver');
	}

	static insertTweet(tweet) {
		let self = this;

		let newTweet = Tweet({
			id: tweet.id_str,
			data: JSON.stringify(tweet),
			created_at: new Date(tweet.created_at)
		});

		newTweet.save();
	}

	static fetchTweets(dateTime) {
		let self = this;

		return new Promise((resolve, reject) => {
			Tweet.find({
				'created_at': {
					$gte: dateTime,
					$lt: dateTime + 3600 * 1000
				}
			}).sort({
				'date': -1
			}).exec((err, tweets) => {
				if(err) {
					reject(err);
				}
				else {
					resolve(tweets);
				}
			});
		});
	}
}

export default Database;
<commit_msg>tweet order<commit_after>'use strict';

import mongoose from 'mongoose';

import Tweet from '../models/tweet';

class Database {
	static initialize(config) {
		let self = this;

		mongoose.connect('mongodb://localhost/twitter-archiver');
	}

	static insertTweet(tweet) {
		let self = this;

		let newTweet = Tweet({
			id: tweet.id_str,
			data: JSON.stringify(tweet),
			created_at: new Date(tweet.created_at)
		});

		newTweet.save();
	}

	static fetchTweets(dateTime) {
		let self = this;

		return new Promise((resolve, reject) => {
			Tweet.find({
				'created_at': {
					$gte: dateTime,
					$lt: dateTime + 3600 * 1000
				}
			}).sort({
				'id': 'asc'
			}).exec((err, tweets) => {
				if(err) {
					reject(err);
				}
				else {
					resolve(tweets);
				}
			});
		});
	}
}

export default Database;

{'fraction_non_alphanumeric': 0.15918869084204057, 'fraction_numerical': 0.010448678549477565, 'mean_word_length': 2.866983372921615, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7362618', 'n_tokens_mistral': 744, 'n_tokens_neox': 597, 'n_words': 127}