[00:08:48] <GothAlice> sterns: Alas, can't really help other than to point out you've included the simpler covered query explain results, but not the aggregate ones. db.collection.explain().aggregate(…)
[00:11:06] <GothAlice> There may also be architectural differences between the two, very distinct, approaches utilized: .toArray() vs. await Promise.all(creators.map(async callback…)). I do not JS, though, so can't really speak to that. Just noticing differences.
[00:13:25] <GothAlice> Also that the covered is a trivial find+project. Aggregates are iterative pipelines, the output of one stage fed to the next, meaning multiplicative performance (O(n*R)), barring some of those stages altering the record count from stage to stage.
[00:25:52] <Zta77> Why aren't my compound indexes shown when I inspect my collection with MongoDB Compass? During collection.createIndex(..) I get an index name returned, and it's present in collections.listIndexes() too.
[00:27:12] <Zta77> I've read that they're supposed to be lazy-created, but I've inserted two documents that are suppose to clash given the unique index, I've (failed to) add lazy-creation is a little too late in this case.
[00:28:29] <sterns> Zta77 the last thing you said makes me think you want to set the `background` option to false
[00:29:00] <sterns> on your create/ensure index stuff
[00:32:00] <Zta77> Even the mongodb logs state the index creation was successful. Here's the gist of what I'm doing: https://pastebin.com/VXSddarn
[00:32:00] <GothAlice> Also possibly that you think index construction is automatic. "Lazy" usually implies automatic, the way "creating a collection" is "lazy" in that it happens automatically on first write operation.
[00:32:14] <GothAlice> OK, phew, tick that one off.
[00:33:02] <sterns> Zta77: using the latest compass?
[00:33:05] <Zta77> The first index i1 isn't really needed; I just wanted to test and demonstrate something that I did that works.
[00:33:42] <Zta77> sterns: I don't know. But my unit test allows adding two clashing documents.
[00:39:39] <Zta77> Updated Compass just to do it. Same result; only one default _id_ index added.
[00:41:32] <Zta77> Any clues? I'm stuck. Most googling leads to collection.ensureIndex() but that method seems deprecated by now.
[00:50:34] <Zta77> Looks similar and very recent: https://github.com/Automattic/mongoose/issues/3393
[01:04:13] <Zta77> MongoDB 4.2.2 Community + mongo-java-driver 3.12.0
[01:23:22] <Zta77> Ok, now it's working. I think it was a combination of an outdated mongodb server and the fact that I drop and recreate databases of the same name during unit testing. There's a warning section about this here https://docs.mongodb.com/manual/reference/method/db.dropDatabase/ . I don't (think) that i'm using sharding, and I don't know what 'mongos' is, but this use-case seem shady, so I'm generating test tables with new names and this se