批量创建数据脚本

var bulk = db.project_customers_58afa2554e6b565b30997032.initializeOrderedBulkOp();

for(var i=0;i<1000000;i++){
bulk.insert(
{
"customer_id" : ObjectId("58b51f27ffe0be7e1db2a31f"),
"project_id" : ObjectId("58afa2554e6b565b30997032"),
"_storage" : {
"level" : "7",
"expired_time" : "2018-02-09",
"create_time" : "2018-02-01 19:05:39.652",
"bigdata_batch_no" : "5a701fa4aac81f8848684152_201802011903"
},
"campaign_id" : ObjectId("58b51f27ffe0be7e1db2a31f"),
"mobile" : "13890908756",
"city_id" : "北京",
"area_id" : "内蒙古",
"level_id" : "0",
"is_inpdlist" : 1,
"previous_callresult" : 1,
"priority" : 0,
"scheduletime" : "2023-02-21 03:34:02",
"sales_funnel_value" : -5,
"agentno" : "1070",
"callresult_id" : ObjectId("5a504fdc9441c5bb0dd7b21a"),
"callresult" : "5",
"sourcetime" : "2023-02-21 03:34:02",
"bigdata_batch_no" : "2018136548866",
"bigdata_label" : "2018新气象",
"called" : 2,
"answered" : 0,
"operator_id" : "5a504fdc9441c5bb0dd7b22d",
"operator_type" : 1,
"create_time" : ISODate("2023-02-20T19:34:03.000Z"),
"update_time" : ISODate("2023-02-20T19:34:03.000Z"),
"schedule_time" : "",
"operate_type" : 3
}
)}
bulk.execute();

你可能感兴趣的:(批量创建数据脚本)