<commit_before>"use strict";
/*
 Created by <NAME> on 2016/12/1
 */
const dbConnection = require("../config/mongoConnection");
const uuid = require("node-uuid");
const blogData = require("../data/blog");
//console.log(blogData);
dbConnection().then(db => {
    return db.collection("blog").drop().then(function(status) {
        console.log("should be true: ",status);
        return db;
    }, function(error) {
        console.log("error in drop blog!")
        //console.log(error);
        return db;
    }).then((db) => {
        console.log("create blog collection!")
        return db.createCollection("blog");
    }).then(function(blogCollection) {
        console.log(blogCollection);
        console.log("in blogCollection");
        //blogData.addBlog(title, content, createTime, mainImage, conclusions, type, tag, userId, siteId)
        var createBlog = function(title, content, mainImage, conclusions,type, tag, userId, siteId){
            console.log("create blog data with", title);
            return {
                _id: uuid.v4(),
                title: title,
                content: content,
                createTime: new Date("<YYYY-mm-dd>"),
                mainImage: mainImage,
                conclusions: conclusions,
                type: type,
                tag: tag,
                userId: userId,
                siteId: siteId
            }
        };

        var list = [];
        // blog_1 Beijing
        var blog1 = createBlog("blog1", "content1", {tag: ["tag1","tag2"]});

        // blog_2 Shanghai
        var blog2 = createBlog("blog2", "content2", {tag:["tag1","tag2"]});

        // blod_3 Shenzhen
        var blog3 = createBlog("blog3", "content3", {tag:["tag1","tag2"]});

        list.push(blog1, blog2, blog3);
        return blogCollection.insertMany(list).then(() => {
            console.log("insertMany");
            return blogCollection.find().toArray();
        });
    })
    .then((list)=>{
        console.log("list stored in collection: ")
        console.log(list);
    })
    .catch(error=>{
        console.log("Error here: ");
        console.log(error);
    });
});
<commit_msg>update#5<commit_after>"use strict";
/*
 Created by <NAME> on 2016/12/1
 */
const dbConnection = require("../config/mongoConnection");
const uuid = require("node-uuid");
const blogData = require("../data/blog");
//console.log(blogData);
dbConnection().then(db => {
    return db.collection("blog").drop().then(function(status) {
        console.log("should be true: ",status);
        return db;
    }, function(error) {
        console.log("error in drop blog!")
        //console.log(error);
        return db;
    }).then((db) => {
        console.log("create blog collection!")
        return db.createCollection("blog");
    }).then(function(blogCollection) {
        console.log(blogCollection);
        console.log("in blogCollection");
        //blogData.addBlog(title, content, createTime, mainImage, conclusions, type, tag, userId, siteId)
        var createBlog = function(title, content, mainImage, conclusions,type, tag, userId, siteId){
            console.log("create blog data with", title);
            return {
                _id: uuid.v4(),
                title: title,
                content: content,
                createTime: new Date("<YYYY-mm-dd>"),
                mainImage: mainImage,
                conclusions: conclusions,
                type: type,
                tag: tag,
                userId: userId,
                siteId: siteId
            }
        };

        var list = [];
        // blog_1 Beijing
        var blog1 = createBlog("blog1", "content1", {tag: ["tag1","tag2"]});

        // blog_2 Shanghai
        var blog2 = createBlog("blog2", "content2", {tag:["tag1","tag2"]});

        // blod_3 Shenzhen
        var blog3 = createBlog("blog3", "content3", {tag:["tag1","tag2"]});

        list.push(blog1, blog2, blog3);
        return blogCollection.insertMany(list).then(() => {
            console.log("insertMany");
            return blogCollection.find().toArray();
        });
    })
    .then((list)=>{
        console.log("list stored in collection: ")
        console.log(list);
        db.close();
    })
    .catch(error=>{
        console.log("Error here: ");
        console.log(error);
    });
});

{'fraction_non_alphanumeric': 0.15945383013191392, 'fraction_numerical': 0.013654246702152279, 'mean_word_length': 2.1026561378320174, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '3773315', 'n_tokens_mistral': 1255, 'n_tokens_neox': 1216, 'n_words': 263}