Sha256: 10e6c7596b20f59ae2e967d70b3852bffd850b128f4bd2330b5bd88cfed16bcf

Contents?: true

Size: 1.08 KB

Versions: 168

Compression:

Stored size: 1.08 KB

Contents

aggregate:
  "function(obj, prev) {
     prev.count++;
   }"

group:
  "function(obj, prev) {
     prev.group.push(obj);
   }"

max:
  "function(obj, prev) {
     if (obj.[field] && prev.max == 'start') {
       prev.max = obj.[field];
     }
     if (obj.[field] && prev.max < obj.[field]) {
       prev.max = obj.[field];
     }
   }"

max_finalize:
  "function(obj) {
     if (obj.max == 'start' || isNaN(obj.max)) {
       obj.max = 0;
     }
     return obj;
   }"

min:
  "function(obj, prev) {
     if (obj.[field] && prev.min == 'start') {
       prev.min = obj.[field];
     }
     if (obj.[field] && prev.min > obj.[field]) {
       prev.min = obj.[field];
     }
   }"

min_finalize:
  "function(obj) {
     if (obj.min == 'start' || isNaN(obj.min)) {
       obj.min = 0;
     }
     return obj;
   }"

sum:
  "function(obj, prev) {
     if (prev.sum == 'start') {
       prev.sum = 0;
     }
     if (obj.[field]) {
       prev.sum += obj.[field];
     }
  }"

sum_finalize:
  "function(obj) {
     if (obj.sum == 'start' || isNaN(obj.sum)) {
       obj.sum = 0;
     }
     return obj;
   }"

Version data entries

168 entries across 76 versions & 4 rubygems

Version Path
mongoid-2.7.1 lib/mongoid/javascript/functions.yml
mongoid-2.7.0 lib/mongoid/javascript/functions.yml
mongoid-2.6.0 lib/mongoid/javascript/functions.yml
mongoid-2.5.2 lib/mongoid/javascript/functions.yml
classiccms-0.6.9 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/javascript/functions.yml
classiccms-0.6.9 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/javascript/functions.yml
classiccms-0.6.9 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/javascript/functions.yml
classiccms-0.6.8 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/javascript/functions.yml
classiccms-0.6.8 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/javascript/functions.yml
classiccms-0.6.8 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/javascript/functions.yml
classiccms-0.6.7 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/javascript/functions.yml
classiccms-0.6.7 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/javascript/functions.yml
classiccms-0.6.7 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/javascript/functions.yml
mongoid-2.5.1 lib/mongoid/javascript/functions.yml
classiccms-0.6.6 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/javascript/functions.yml
classiccms-0.6.6 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/javascript/functions.yml
classiccms-0.6.6 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/javascript/functions.yml
classiccms-0.6.5 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/javascript/functions.yml
classiccms-0.6.5 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/javascript/functions.yml
classiccms-0.6.5 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/javascript/functions.yml