anohigisavayhello! i want to wrap a document field value into an array
anohigisavayfor example, {a: 1, b: 2} -> {a: 1, b: [2]}
anohigisavaywhat can i do?
SaintMoriartyHi, Can I have mongo trigger a command set by a user when a user disconnects from the db?
loquacehello inside
Derickhi?
bromancan someone please help me? I'm experienced programmer with a few languages, but recently I was assigned for one mission that envolves mongo... The server's cpu is too high a few times a day... when I issue a mongotop, I get myuser._Join:users:_Role 852ms 379ms 472ms ... I think this response time is too high... My first question is: What is that collecion _Join:users:_Role??? I tried to rebuild it's indexes without success
evulishsay i have a bunch of docs like { title: "blap", owners: [{id: 1,},] }, how do i search for all documents with documents that have id: 1 in the owners array
nbettenhIs there a way to capture any updates written to a collection to sync to another database? We're in the process of upgrading and would like both versions side-by-side to verify the code will work with the new database.
nbettenhI'm grabbing dumps based on the ObjectId to get any new documents added, but can't think of a way to get updates to those documents
Derickevulish: find ( { 'owners.id': 1 } );
Dericknbettenh: do you have replication set-up? you could use that to "tail the oplog". For 3.6, most drivers will also implement "change streams" to help you with this
nbettenhDerick: I like that idea, I'll look into doing that. Unfortunately this is a WAY too old 2.2 install we're trying to get as far away from as possible
Derickoh, yeah
Dericknot sure if you can do that with 2.2! :)
MarkyCHey everyone, I'm working on a project that's using mongo to record customer usage information. Each usage record is inserted into a table usage_records (example: { user: 123, usage: 1024}). Now if we need the user's total usage, it would be the aggregate sum of the usage in all the records for a user. Is there a way to precompute this, like (materialized) views?
MarkyCI see that Mongo's views are computed at _read time_, but I'm looking for a way to have that done in the background so the lookup is precomputed
MarkyC(obviously willing to trade disk space/IO here)
Tjololo12MarkyC: looks like there's a ticket open for this https://jira.mongodb.org/browse/SERVER-27698 I'm not sure if it's been implemented in any way, but it was updated on Oct. 17th
MarkyCTjololo12: thanks!
Tjololo12np