diff options
author | Andrew Morrow <acm@10gen.com> | 2013-08-19 17:26:20 -0400 |
---|---|---|
committer | Andrew Morrow <acm@10gen.com> | 2013-08-20 11:48:47 -0400 |
commit | c735600b22a78b8736c89568332a321a6753e924 (patch) | |
tree | 2154f3cbf9e2d4d2bb8dbe8b316bf4727fa18279 /src/mongo/db/ops/modifier_inc.h | |
parent | 4a6f0941c13ac6a197bb787e238ddbc12120b641 (diff) | |
download | mongo-c735600b22a78b8736c89568332a321a6753e924.tar.gz |
SERVER-375 Implement $mul by way of $inc
Diffstat (limited to 'src/mongo/db/ops/modifier_inc.h')
-rw-r--r-- | src/mongo/db/ops/modifier_inc.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/mongo/db/ops/modifier_inc.h b/src/mongo/db/ops/modifier_inc.h index 0425f0c3a35..6a3fece395c 100644 --- a/src/mongo/db/ops/modifier_inc.h +++ b/src/mongo/db/ops/modifier_inc.h @@ -33,7 +33,19 @@ namespace mongo { public: - ModifierInc(); + // TODO: This is a shortcut to implementing $mul by hijacking $inc. In the near future, + // we should consider either pulling $mul into its own operator, or creating a general + // purpose "numeric binary op" operator. Potentially, that operator could also subsume + // $bit (thought there are some subtleties, like that $bit can have multiple + // operations, and doing so with arbirary math operations introduces potential + // associativity difficulties). At the very least, if this mechanism is retained, then + // this class should be renamed at some point away from ModifierInc. + enum ModifierIncMode { + MODE_INC, + MODE_MUL + }; + + ModifierInc(ModifierIncMode mode = MODE_INC); virtual ~ModifierInc(); /** @@ -58,6 +70,7 @@ namespace mongo { virtual Status log(LogBuilder* logBuilder) const; private: + const ModifierIncMode _mode; // Access to each component of fieldName that's the target of this mod. FieldRef _fieldRef; |