[SERVER-15680] $bit update operator should support BinData type Created: 16/Oct/14  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Write Ops
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: Justin Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Assigned Teams:
Query Execution
Participants:

 Description   

The $bit update bitwise operator currently supports 32- and 64-byte data integers. It would be helpful to allow bitwise operations for BinData types as well.

The existing operators AND, OR, and XOR could be extended to take in a BinData type and modify the original BinData as appropriate.

An additional SET or CLEAR operator might also be useful in addition to or as a replacement for the AND, OR, and XOR operators when operating on BinData. This would allow the server to avoid converting chunks of data by simply updating the appropriate byte. For example, the following would set the 124th bit in the field "bloom" of type BinData.

{ $bin: { bloom:

{ set: 124 }

} }



 Comments   
Comment by Justin [ 16/Oct/14 ]

This functionality would be especially useful for keeping bloom filters within documents. For example, if a document exists with a large series of arrays and a bloom filter, I can query the bloom field instead of the entire document to avoid retrieving excess data. It would further allow performing inserts into an array and updating the bloom filter simultaneously by using $addToSet in conjunction with $bit (though this would require allowing an array of [ SET: bit ]).

Generated at Thu Feb 08 03:38:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.