|
| 1 | +:orphan: |
| 2 | + |
| 3 | +===================================================== |
| 4 | +Compatibility Changes in for Development Series 3.1.x |
| 5 | +===================================================== |
| 6 | + |
| 7 | +.. default-domain:: mongodb |
| 8 | + |
| 9 | +MongoDB 3.2 is currently in development as part of the 3.1.x |
| 10 | +development release series. |
| 11 | + |
| 12 | +.. warning:: |
| 13 | + |
| 14 | + While 3.1.x releases are available, these versions of MONGODB are |
| 15 | + for **testing purposes only and not for production use**. |
| 16 | + |
| 17 | +This document covers the 3.1 development series as a work-in-progress. |
| 18 | +Features are subject to change. See also |
| 19 | +:doc:`/release-notes/3.1-dev-series`. |
| 20 | + |
| 21 | +.. TODO For the rc, must find and replace both the version-xxx and all 3.1 instances since the page distinguishes between dev versions as well. |
| 22 | + |
| 23 | +.. |version-dev| replace:: 3.1.6 |
| 24 | + |
| 25 | +.. |version-wt| replace:: 3.1.4 or greater |
| 26 | + |
| 27 | +The following changes can affect the compatibility with older versions |
| 28 | +of MongoDB. |
| 29 | + |
| 30 | +.. _3.2-storage-engine-compatibility: |
| 31 | + |
| 32 | +Default Storage Engine Change |
| 33 | +----------------------------- |
| 34 | + |
| 35 | +Starting in 3.1.4, MongoDB uses the WiredTiger as the default storage |
| 36 | +engine. Previous versions used the MMAPv1 as the storage engine. |
| 37 | + |
| 38 | +For existing deployments, if you do not specify the ``--storageEngine`` |
| 39 | +or the :setting:`storage.engine` setting, MongoDB automatically |
| 40 | +determines the storage engine used to create the data files in the |
| 41 | +``--dbpath`` or :setting:`storage.dbPath`. |
| 42 | + |
| 43 | +For new deployments, to use MMAPv1, you must explicitly specify the |
| 44 | +storage engine setting either: |
| 45 | + |
| 46 | +- On the command line with the ``--storageEngine`` option: |
| 47 | + |
| 48 | + .. code-block:: sh |
| 49 | + |
| 50 | + mongod --storageEngine mmapv1 |
| 51 | + |
| 52 | +- Or in a :doc:`configuration file </reference/configuration-options>`, |
| 53 | + using the :setting:`storage.engine` setting: |
| 54 | + |
| 55 | + .. code-block:: yaml |
| 56 | + |
| 57 | + storage: |
| 58 | + engine: mmapv1 |
| 59 | + |
| 60 | +Index Changes |
| 61 | +------------- |
| 62 | + |
| 63 | +.. _3.2-version-0-indexes: |
| 64 | + |
| 65 | +Version 0 Indexes |
| 66 | +~~~~~~~~~~~~~~~~~ |
| 67 | + |
| 68 | +MongoDB 3.1.9 disallows the creation of version 0 indexes (i.e. ``{v: |
| 69 | +0}``). If version 0 indexes exist, MongoDB 3.1.9 outputs a warning log |
| 70 | +message, specifying the collection and the index. |
| 71 | + |
| 72 | +Starting in MongoDB 2.0, MongoDB started automatically upgrading ``v: |
| 73 | +0`` indexes during :ref:`initial sync <replica-set-initial-sync>`, |
| 74 | +:program:`mongorestore` or :dbcommand:`reIndex` operations. |
| 75 | + |
| 76 | +If a version 0 index exists, you can use any of the aforementioned |
| 77 | +operations as well as drop and recreate the index to upgrade to the |
| 78 | +``v: 1`` version. |
| 79 | + |
| 80 | +For example, if upon startup, a warning message indicated that an index |
| 81 | +``index { v: 0, key: { x: 1.0 }, name: "x_1", ns: "test.legacyOrders" |
| 82 | +}`` is a version 0 index, to upgrade to the appropriate version, you |
| 83 | +can drop and recreate the index: |
| 84 | + |
| 85 | + .. code-block:: javascript |
| 86 | + |
| 87 | + use test |
| 88 | + db.legacyOrders.dropIndex( "x_1" ) |
| 89 | + |
| 90 | + or by key: |
| 91 | + |
| 92 | + .. code-block:: javascript |
| 93 | + |
| 94 | + use test |
| 95 | + db.legacyOrders.dropIndex( { x: 1 } ) |
| 96 | + |
| 97 | +#. Recreate the index without the version option ``v``: |
| 98 | + |
| 99 | + .. code-block:: none |
| 100 | + |
| 101 | + db.legacyOrders.createIndex( { x: 1 } ) |
| 102 | + |
| 103 | +.. comment Also, need to remove index version option in the createIndex page (+ any other places that seems to suggest you can manually set v:0) in 3.2 manual. |
| 104 | + |
| 105 | +.. _3.2-text-index-compatibility: |
| 106 | + |
| 107 | +Text Index Version 3 Compatibility |
| 108 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 109 | + |
| 110 | +:ref:`Text index (version 3) <3.2-relnotes-text-index-v3>` is |
| 111 | +incompatible with earlier versions of MongoDB. Earlier versions of |
| 112 | +MongoDB will not start if :doc:`text index (version 3) |
| 113 | +</core/index-text>` exists in the database. |
| 114 | + |
| 115 | +.. _3.2-2dsphere-index-compatibility: |
| 116 | + |
| 117 | +``2dsphere`` Index Version 3 Compatibility |
| 118 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 119 | + |
| 120 | +:ref:`2dsphere index (version 3) <3.2-relnotes-2dsphere-index>` is |
| 121 | +incompatible with earlier versions of MongoDB. Earlier versions of |
| 122 | +MongoDB will not start if ``2dsphere`` index (version 3) exists in the |
| 123 | +database. |
| 124 | + |
| 125 | +.. _3.2-agg-compatibility: |
| 126 | + |
| 127 | +Aggregation Compatibility Changes |
| 128 | +--------------------------------- |
| 129 | + |
| 130 | +- :group:`$avg` accumulator returns null when run against a |
| 131 | + non-existent field. Previous versions returned ``0``. |
| 132 | + |
| 133 | +- :expression:`$substr` errors when the result is an invalid UTF-8. |
| 134 | + Previous versions output the invalid UTF-8 result. |
| 135 | + |
| 136 | +- Array elements are no longer treated as literals in the aggregation |
| 137 | + pipeline. Instead, each element of an array is now parsed as an |
| 138 | + expression. To treat the element as a literal instead of an |
| 139 | + expression, use the :expression:`$literal` operator to create a |
| 140 | + literal value. |
| 141 | + |
| 142 | + |
| 143 | +.. _3.2-spidermonkey-compatibility: |
| 144 | + |
| 145 | +SpiderMonkey Compatibility Changes |
| 146 | +---------------------------------- |
| 147 | + |
| 148 | +The change to SpiderMonkey may cause incompatibility issues for |
| 149 | +JavaScript code that relies on specific V8 functionality/behavior. |
| 150 | + |
| 151 | +Additional Information |
| 152 | +---------------------- |
| 153 | + |
| 154 | +See also :doc:`/release-notes/3.1-dev-series`. |
0 commit comments