PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Monday the 17th of August, 2020

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[14:09:59] <SJr> I have an API where I need to upsert an record in the persistence layer. Conceptually this entity should also create a 'bucket' as well. The entity has a unique identifier, but the 'bucket' doesn't. Right now I'm modelling the entity as a element in a document that represents the bucket. This seems not great as the bucket document can grow without bound.
[14:10:40] <SJr> I think the best thing to do is to split the bucket and entity into seperate collections, but I'm having trouble (since I'm new to mongo), thinking about the best way to write this code, since I don't have a transaction.
[14:11:22] <SJr> If two calls for the same entity come in at the same time, it's possible for them to put them in two distinct buckets.
[14:13:51] <SJr> I could do something like create bucket document, upsert into entity collection don't change bucket document link, and then read bucket document link and delete the old one.
[14:15:15] <SJr> I could also do something like upsert into bucket document with hidden "created_by_entity" field with the id, and then upsert into entity collection.
[21:35:40] <TimMc> I'm using `mongo --eval` to dump some data and I'm having trouble getting it into JSON format. (I don't have mongoexport available.) Is there some function that will produce Extended JSON e.g. {"$oid":"12345} rather than ObjectId("12345")?
[23:18:31] <c4017w> How can I sum all fields in $group without specifying each field? e.g. {"a": 2, b: 1}, {"a": 2, "c": 1} -> {"a": 4, "b": 1, "c": 1}