[09:53:43] <Lope> Is it possible to change the formatting of pretty() to use colour and also exclude unnecessary quotes, so instead of outputting in JSON format, just output in Javascript format?
[15:55:19] <Industrial> This method isn't available from Node.js. Only from the mongo client?
[16:00:18] <GothAlice> Industrial: Every driver that I am aware of exposes ensureIndex at the collection level. Which driver are you using?
[16:00:45] <GothAlice> E.g. ref: the DBCollection.prototype.ensureIndex definition on line 707 of http://api.mongodb.com/js/current/symbols/src/src_mongo_shell_collection.js.html
[16:03:44] <GothAlice> Deprecated because what this does is a shortcut that many use to shoot themselves in the foot, implemented either carefully (list indexes, if not present, create) or through brute-force (create the index, watch to see if it fails), with the important sticking point that foreground indexing operations lock the collection during the index build.
[16:04:31] <GothAlice> (So a DAO layer on top of MongoDB automatically iterating all known document types calling ensure_index on every known index on every startup can end up preventing your application from being usable. For hours.)
[22:01:47] <Sasazuka> in the mongo shell is there some way to get a warning when I type the DB or collection name wrong? e.g. "use no_such_db"
[22:09:04] <GothAlice> Sasazuka: Not entirely sure how it might "figure out the right thing to do", let alone if you want it to auto-correct things for you, the consequences could be disastrous. Your question approaches one made famous by Charles Babbage. "On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?'" ;P
[22:09:32] <GothAlice> db.users_legacy.drop() → "users_legacy couldn't be found, but users is a thing, I'll drop that for you instead!"
[22:09:58] <Sasazuka> oh I don't need it to autocorrect to another DB, I just want it to warn me when I have a typo
[22:10:10] <GothAlice> That was a correction of a collection name within a single DB.
[22:11:04] <Sasazuka> if I "use someDB" and "someDB" doesn't exist, I'm assuming I can't do anything to cause it to exist therefore no commands would produce results
[22:12:12] <GothAlice> MongoDB is a "lazily construct on first access" system. All valid names exist. But don't unless something has been written to them. But do, since you can query non-existent collections or switch to non-existent DBs. (Switch to a non-existent DB and write no data, nothing gets created.)
[22:13:12] <GothAlice> Ultimately it can't reliably tell intent ("I'm intentionally creating a new DB" vs. "I want to only use an existing one") from just the word "use". "use db" — it can only assume you write what you mean, and if the name doesn't exist, that's A-OK.
[22:13:39] <GothAlice> (It'll assume you're intentionally about to create a new one with your first write.)
[22:14:01] <Sasazuka> and the same applies to collections? db.noCollection.find({..}) ?
[22:14:37] <GothAlice> MongoDB assumes you know what you're doing.
[22:14:40] <GothAlice> Now, that's not to say the syntax couldn't be extended. "use <db>" as it is right now, but "use existing <db>" would error if it didn't exist.
[22:15:02] <GothAlice> You might open a ticket on JIRA to suggest this; or search around and vote for it if someone else has already submitted it.
[22:22:46] <Sasazuka> probably not a big deal, just curious if the functionality already exists
[22:57:11] <damoncasale> projectsInvited, which is an array, needs to contain all elements given in the matching array -- in this case, ["1"] but could have more elements in it. projectsFinished, which is also an array, needs to contain NONE of the elements given in the matching array. Hope that makes sense. Just having a hard time figuring out how to do that with Mongo.
[22:58:25] <damoncasale> Tried using $in and $nin but those won't work, because I'm not trying to match nested arrays. I want to match all array elements contained in an array in a sample record, or NONE of the array elements contained in an array in a sample record.