0

I am looking to do probabilistic counting and set membership using structures such as bloom filters and hyperloglog. I assume I can store such structures as binary data, but I don't want to use optimistic locking (a.k.a. update if current) because contention is high.

Is there any support for using such data structures and performing operations on them atomically on the server-side, through user-defined functions or similar? Or any way for me to add extensions with such functionality?

(I could ingest the data through another system and batch the updates to reduce the contention, but it would be far simpler if all this could be handled in the database server.)

Juan Lopes
  • 10,143
  • 2
  • 25
  • 44
Daniel Siegmann
  • 287
  • 1
  • 3
  • 5

1 Answers1

0

I'm no specialist in MongoDB, but it seems to me you can store HyperLogLog (and Bloom Filter as well) in an array inside a document. The only operation both of them really need is $max, that is atomic (I think).

You don't have to update the entire document, only the array position affected by the single element.

Juan Lopes
  • 10,143
  • 2
  • 25
  • 44