MongoDB 4.0 RC Version Strong login

Source: Internet
Author: User
Tags mongodb mongodb version

Summary:MONGODB 4.0 has launched more powerful support for its flexible document model, extensible distributed design, and the 4.0 first RC version has been released, and this article introduces some of the new features of the MongoDB 4.0 core.

MONGODB 4.0 has launched more powerful support for its flexible document model, extensible distributed design, and the 4.0 first RC version has been released, and this article introduces some of the new features of the MongoDB 4.0 core.

Multiple file transaction (multi-document ACID Transaction)

With the support of embedded arrays and documents in the MongoDB document model, the current single document transaction can meet the needs of most developers. In order for MongoDB to adapt to more scenarios and make development easier, MongoDB 4.0 will support multi-document transactions across one or more collections within a replica set, guaranteeing the atomicity of updates to multiple documents. In future MongoDB version 4.2, the distributed transaction of the Shard cluster will also be supported.

MongoDB's transactional interface is very simple, and developers simply need to put "an update sequence that requires guaranteed atomicity" between one session and the next 开始事务 提交事务 .

Here is an example of a Python API using a transaction

With Client.start_session () as S:s.start_transaction (): Try:collection.insert_one (Doc1, Session=s) c Ollection.insert_one (DOC2, Session=s) except:s.abort_transaction () Raise S.commit_transaction ()

Here is an example of a Java API usage transaction

Try (clientsession clientsession = Client.startsession ()) {clientsession.starttransaction ();         try {collection.insertone (clientsession, Docone);         Collection.insertone (Clientsession, doctwo);     Clientsession.committransaction ();     } catch (Exception e) {clientsession.aborttransaction (); }}


Transactions are the result of more than 3 years of efforts by the MongoDB development team, from the 3.0 release of the Wiredtiger, to the 3.2 version of support Readconcern, 3.6 support causal consistency and many other tasks are in preparation for the transaction function, Finally, the entire transaction API is provided to the user in version 4.0 to help the user build the application better.

Aggregation type conversion (Aggregation Pipeline type Conversions)

The flexible document model is one of the great advantages of MongoDB compared to traditional relational databases, where application developers do not have to pre-define structures (or patterns) for stored data, allowing developers to quickly respond to iterations of development needs, while being flexible, MongoDB also provides schema validation functionality, Enables developers to define the model of document data as needed.

MongoDB's documentation allows users to flexibly write to various types of data fields, which brings some complexity to consumer data, such as some data analysis scenarios where applications typically want data from a field to have a uniform type to facilitate data processing.

MongoDB 4.0 introduces a new aggregation operator $convert that allows the user to aggregation pipeline convert a document's fields into a uniform type output, making it easier for data consumers such as MongoDB BI tools, Spark connectors, and other ETL tools to handle M Ongodb data.

Non-blocking standby node read (non-blocking secondary Reads)

In order to ensure that the read on the standby node maintains the same causal consistency semantics as the primary node, the MongoDB standby node blocks the read request when the Oplog is applied in bulk, which allows the average latency of the standby node to read higher than the primary node under high write load.

With the implementation of transactional functionality  storage engine timestamps and snapshots  , the engine layer can easily implement "specify timestamp snapshot read" so that read requests on the standby node can read the data at a consistent point in time without blocking the wait. This feature will greatly enhance the ability of MongoDB to read and expand.

Migration Speed Boost 40% (40% Faster Data migrations)

Application in the process of continuous evolution, its load characteristics are constantly changing, which requires that the database has the ability to scale, and adapt to the application load changes in time. MongoDB Shard clusters support real-time additions, removal of shard nodes, and the ability to automatically migrate data between individual shard to balance the load.

MongoDB 4.0 supports the process of migrating data, concurrent reads (source side) and write (target side), which improves the performance of the migration by about 40%, allowing the newly added nodes to load the business pressure faster, so that the Shard cluster can play the best effect.

Extended Modify Subscription (Extensions to change Streams)

MongoDB 3.6 introduces the ability to modify subscriptions (change Streams), allowing users to get data changes in real-time, while also making it easy to synchronize data in multiple data centers across replication sets through the change Streams. MongoDB 4.0 further expands the change Streams feature to enable modified subscriptions for the Shard cluster dimension.

Start to experience MongoDB 4.0 RC
    • Bash here Experience MongoDB 4.0 RC

    • View release Notes for MongoDB 4.0 Release Candidate

Original link


MongoDB 4.0 RC Version Strong login

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.