2

I would like to move from MYSQL to MongoDB, one of the question I can not find answer for, if I can get or simulate XOR and Bit Count, which I need.

In MYSQL I would do:

SELECT BIT_COUNT(SimHash ^ $SimHash) as simhash ... ORDER BY simhash

It is possible to do something similar in MongoDB ?

Basically I want to do Simhashing, nice article for PHP/MySQL is http://www.titouangalopin.com/blog/2014-05-29-simhash

I need BitCount to support higher than 64bit integers.

2ge
  • 269
  • 4
  • 12
  • 1
    The only MongoDB methods that "alter" the results returned by calcuation in any way are `.aggregate()` and `.mapReduce()`, and mapReduce cannot "ORDER" results other than by something contained as a primary component of the grouping key. Perhaps you would be better off explaining your case with some sample data and expected results. Moreover you should explain the "similarity" case you are looking for, as there may well be other approaches you have not considered. – Blakes Seven Feb 03 '16 at 11:09
  • 1
    I need to count hamming distance in MongoDB. More here: https://en.wikipedia.org/wiki/Hamming_distance – 2ge Feb 21 '16 at 10:32

0 Answers0