/**
 * Created by Mai on 2017/6/12.
 */

class baseModel {
    constructor (model) {
        this.model = model;
    };

    /**
     * 查询数据
     * @param query
     * @param fields
     * @returns {Promise|Array|{index: number, input: string}}
     */
    getQueryData (query, fields) {
        return this.model.find(query, fields).exec();
    };

    /**
     * 批量插入数据
     * @param datas
     * @param callback
     */
    insertData (datas, callback) {
        this.model.collection.insert(datas, callback);
    };
};

module.exports = baseModel;