I'm trying to bulk insert thousands of entries into Mongo, what I'm looking for is some sort of way to define a template and only change 1 / multiple variables in that document instead of sending thousands of huge documents that are actually the same thing, only having something like a number changed in them.
For example, a simple example that works in the Mongo Shell would be:
var myUniqueNumbers = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233];
var col = db.getCollection('userSiteTimes');
myUniqueNumbers.forEach(function(i){
col.insert({hugeDocument: true, x: i});
});
How can I do something similar via the Node.js Driver?