|
|
@@ -15,22 +15,22 @@ var AddToSetAccumulator = module.exports = function AddToSetAccumulator(){
|
|
|
|
|
|
var Value = require("../Value");
|
|
|
|
|
|
-proto.processInternal = function processInternal(input, merging) {
|
|
|
- if (!merging) {
|
|
|
- if (input !== undefined) {
|
|
|
- this.set[JSON.stringify(input)] = input;
|
|
|
- }
|
|
|
- } else {
|
|
|
- // If we're merging, we need to take apart the arrays we
|
|
|
- // receive and put their elements into the array we are collecting.
|
|
|
- // If we didn't, then we'd get an array of arrays, with one array
|
|
|
- // from each merge source.
|
|
|
+proto.processInternal = function processInternal(input, merging) {
|
|
|
+ if (!merging) {
|
|
|
+ if (input !== undefined) {
|
|
|
+ this.set[JSON.stringify(input)] = input;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // If we're merging, we need to take apart the arrays we
|
|
|
+ // receive and put their elements into the array we are collecting.
|
|
|
+ // If we didn't, then we'd get an array of arrays, with one array
|
|
|
+ // from each merge source.
|
|
|
if (!Array.isArray(input)) throw new Error("Assertion failure");
|
|
|
|
|
|
- for (var i = 0, l = input.length; i < l; i++) {
|
|
|
+ for (var i = 0, l = input.length; i < l; i++) {
|
|
|
this.set[JSON.stringify(input[i])] = input[i];
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
proto.getValue = function getValue(toBeMerged) {
|
|
|
@@ -43,13 +43,13 @@ proto.getValue = function getValue(toBeMerged) {
|
|
|
};
|
|
|
|
|
|
proto.reset = function reset() {
|
|
|
- this.set = {};
|
|
|
+ this.set = {};
|
|
|
};
|
|
|
|
|
|
klass.create = function create() {
|
|
|
- return new AddToSetAccumulator();
|
|
|
+ return new AddToSetAccumulator();
|
|
|
};
|
|
|
|
|
|
proto.getOpName = function getOpName() {
|
|
|
- return "$addToSet";
|
|
|
+ return "$addToSet";
|
|
|
};
|