Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-153

javascript sort helper for custom sorting / indexing

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: planned but not scheduled
    • Component/s: Indexing
    • Labels:
      None

      Issue Links

        Activity

        Hide
        serbrech stephane erbrech added a comment -

        Ok, thanks for details. That would for sure be useful. though overkill for my use case that only needs to return null last when sorting.

        Show
        serbrech stephane erbrech added a comment - Ok, thanks for details. That would for sure be useful. though overkill for my use case that only needs to return null last when sorting.
        Hide
        ihristov Ivan Hristov added a comment -

        This will be really a great feature. I'm especially interested in transforming a string field representing a number and then sorting by the number.

        Show
        ihristov Ivan Hristov added a comment - This will be really a great feature. I'm especially interested in transforming a string field representing a number and then sorting by the number.
        Hide
        flashy Lukas Gutschmidt added a comment -

        Something like Views in Couchbase. I need that so badly.

        Show
        flashy Lukas Gutschmidt added a comment - Something like Views in Couchbase. I need that so badly.
        Hide
        liqiang Qiang Li added a comment -

        We would like to sort by computed values based on some time related fields. e.g. a document will be listed at the top if today is in its date range. it will not be practical to store precomputed values.

        Show
        liqiang Qiang Li added a comment - We would like to sort by computed values based on some time related fields. e.g. a document will be listed at the top if today is in its date range. it will not be practical to store precomputed values.
        Hide
        dpamio Diego Pamio added a comment -

        We need it for the following use case:

        var myPerceptualHash = '0239582305980';
        db.coll1.find().sort({ 
            $by : function( a, b ) {
                var hummingDistance = require('humming-distance');
                return hummingDistance(myPerceptualHash, a.phash) < hummingDistance(myPerceptualHash, b.phash;
            }
        }).limit(1)
        

        Show
        dpamio Diego Pamio added a comment - We need it for the following use case: var myPerceptualHash = '0239582305980'; db.coll1.find().sort({ $by : function( a, b ) { var hummingDistance = require('humming-distance'); return hummingDistance(myPerceptualHash, a.phash) < hummingDistance(myPerceptualHash, b.phash; } }).limit(1)

          People

          • Votes:
            104 Vote for this issue
            Watchers:
            68 Start watching this issue

            Dates

            • Created:
              Updated:
              Days since reply:
              2 weeks, 4 days ago
              Date of 1st Reply: