我有300万个主要对象和5千个程序对象,它们将使用程序活动映射在一起,因此主要对象将具有多个程序对象。所以我的问题是,我可以存储300万条线索,将程序保存在一个对象中吗?
例如:
{
"lead78354": {
"First Name": "test",
"Last Name": "test",
"Id": "78354",
"Email Address": "webintegtest.gb_3.1412@yopmail.com",
"FirstLeadSource": "null",
"leadStatus": "Qualified",
"country": "US",
"SEInferredCountry": "null",
"LastProgramSuccess": "null",
"HistoryOfProgramSuccesses": "Dec 14, 2017 : US_All_Contact_Sale",
"programs": {
"program1": {
"id": 1324,
"description": "•\tContent selection LP & TY",
"createdAt": "2015-02-27T15:18:31Z+0000",
"updatedAt": "2017-12-17T15:09:39Z+0000",
"type": "Default",
"channel": "Content",
"folder": {
"type": "Folder",
"value": 7685,
"folderName": "US Country Pages"
},
"status": "",
"workspace": "NAM",
"tags": [{
"tagType": "Marketing Campaign",
"tagValue": "EcoBuildings"
}, {
"tagType": "Primary Business",
"tagValue": "All Business Units"
}, {
"tagType": "Primary Country",
"tagValue": "US"
}, {
"tagType": "Primary Market Segmentation",
"tagValue": "All Segments"
}],
"costs": []
}
}
},
lead2:{
"test":"test"
programs:{.......}
}
so on....
}
答案 0 :(得分:1)
是的,你可以。您所要做的就是创建一个对象,然后添加具有唯一ID的新对象。我在下面添加了一个片段。这里唯一的限制似乎是你的RAM。
var allobjects = {};
var sampleObj = {
"First Name": "test",
"Last Name": "test",
"Id": "78354",
"Email Address": "webintegtest.gb_3.1412@yopmail.com",
"FirstLeadSource": "null",
"leadStatus": "Qualified",
"country": "US",
"SEInferredCountry": "null",
"LastProgramSuccess": "null",
"HistoryOfProgramSuccesses": "Dec 14, 2017 : US_All_Contact_Sale",
"programs": {
"program1": {
"id": 1324,
"description": "•\tContent selection LP & TY",
"createdAt": "2015-02-27T15:18:31Z+0000",
"updatedAt": "2017-12-17T15:09:39Z+0000",
"type": "Default",
"channel": "Content",
"folder": {
"type": "Folder",
"value": 7685,
"folderName": "US Country Pages"
},
"status": "",
"workspace": "NAM",
"tags": [{
"tagType": "Marketing Campaign",
"tagValue": "EcoBuildings"
}, {
"tagType": "Primary Business",
"tagValue": "All Business Units"
}, {
"tagType": "Primary Country",
"tagValue": "US"
}, {
"tagType": "Primary Market Segmentation",
"tagValue": "All Segments"
}],
"costs": []
}
}
};
for (var i=0;i<3000000;i++) {
allobjects[("lead"+i)]=Object.create(sampleObj);
}
var count =0;
for (var prop in allobjects) {
count++;
}
console.log("lead count: " + count);