Slide 1

Slide 1 text

Next Generation mongoDB Christoph Strobl, Pivotal Software Inc. @stroblchristoph Sessions - Streams - Transactions

Slide 2

Slide 2 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Next Generation MongoDB Christoph Strobl Software Engineer, Spring Data Sessions - Streams - Transactions

Slide 3

Slide 3 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Christoph Strobl Fantasy Book Addict Workout Enthusiast Next Generation MongoDB Sessions - Streams - Transactions image: https://wall.alphacoders.com/
 License: PD

Slide 4

Slide 4 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ image: https://wall.alphacoders.com/
 License: PD

Slide 5

Slide 5 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD 10,30 € incl. VAT
 Shipping information 5 $ http GET :8080/book/f430cb49 HTTP/1.1 200 OK Content-Length: 177 Content-Type: application/json;charset=UTF-8 { "authors": [ "Peter V. Brett" ], "id": "f430cb49", "language": "English", "pages": 880, "publishDate": "2017-28-09", "publisherId": "Harper Collins Publishers", "stock": 3, "title": "The Core" }

Slide 6

Slide 6 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD Cart Cart Register Shipping Payment Confirmation 3 copies available The Core 6 only 2 more copies available { _id: "f430cb49", title: "The Core", author: [ "Peter V. Brett" ], published_date: ISODate("2017-09-28"), pages: 880, language: "English", publisher_id: "Harper Collins", available: 2 checkout : [ {by : "cstrobl", date : "2018- ] } $ http POST :8080/book/f430cb49/order HTTP/1.1 200 OK Content-Length: 267 Content-Type: application/json;charset=UTF-8 { "books": [ { "authors": [ "Peter V. Brett" ], "id": "f430cb49", "language": "English", "pages": 880, "publishDate": "2017-28-09", "publisherId": "Harper Collins Publishers", "title": "The Core" } ], "customer": "cstrobl", "date": "2018-09-04" }

Slide 7

Slide 7 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD Cart Cart Register Shipping Payment Confirmation 3 copies available The Core $ http POST :8080/book/f430cb49/order HTTP/1.1 200 OK Content-Length: 267 Content-Type: application/json;charset=UTF-8 { "books": [ { "authors": [ "Peter V. Brett" ], "id": "f430cb49", "language": "English", "pages": 880, "publishDate": "2017-28-09", "publisherId": "Harper Collins Publishers", "title": "The Core" } ], "customer": "cstrobl", "date": "2018-09-04" } 7 only 2 more copies available { "_id" : "5b8ee10e", "by" : "cstrobl", "date" : ISODate("2018-09-04"), "books" : [ { "$ref" : "books", "$id" : "f430cb49" } ] } { _id: "f430cb49", title: "The Core", author: [ "Peter V. Brett" ], published_date: ISODate("2017-09-28"), pages: 880, language: "English", publisher_id: "Harper Collins", available: 2 }

Slide 8

Slide 8 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Multi Document Transactions image: http://www.intestasuimotori.it
 License: CC

Slide 9

Slide 9 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD Requirements 9 // start transaction // update first collection // query second collection // update third collection // commit transaction • ACID • Conversational, multi-statement

Slide 10

Slide 10 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD How To Get From There to Here 10 Wired Tiger MVCC 3.0 - 3.4

Slide 11

Slide 11 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD How To Get From There to Here 11 Logical Sessions 3.6 Retryable Writes

Slide 12

Slide 12 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD How To Get From There to Here 12 update : { lsid : 1, txnNum : 1}, updates: […] update : { lsid : 1, txnNum : 1}, updates: […] { ok : 1} Retryable Writes IO Exception

Slide 13

Slide 13 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD How To Get From There to Here 13 Replica Set Transactions Sharded Cluster Transactions 4.0 4.2 (under development)

Slide 14

Slide 14 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ https://github.com/christophstrobl/mongodb-bookstore image: https://wall.alphacoders.com/
 License: PD

Slide 15

Slide 15 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD Known issues… 15 try(ClientSession session = client.startSession()) { session.startTransaction(); Long result = collection.count(session, Filters.gt("available", 0)); Bson nearSphereFilter = Filters.nearSphere("location", new Point(
 new Position(-73.99D, 40.73D)), 0.313D); Long result = collection.countDocuments(nearSphereFilter); Cannot run 'count' in a multi-document 
 transaction. Error 50851 '$geoNear, $near, and $nearSphere
 are not allowed in this context' Error 2 Long result = collection.countDocuments(session, Filters.gt("available", 0)); Bson nearSphereFilter = Filters.geoWithinCenterSphere("location", -73.99D, 40.73D, 0.313D); Long result = collection.countDocuments(nearSphereFilter);

Slide 16

Slide 16 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD Reactive Multi Document Transactions 16 return mongoOperations.inTransaction().execute(action "-> { return action.save(order) .flatMap(order "-> { return action.update(Book.class) .matching(query( where("id").is(book.id) .and("available").gt(0))) .apply(new Update().inc("available", -1)).first() .flatMap(result "-> { if (result.getModifiedCount() "== 0) { throw new BookSoldOutException(book); } return Mono.just(order); }); }); }).next(); Flux.usingWhen(() "-> session, ClientSession"::commitTransaction, ClientSession"::abortTransaction, session "-> … ) @Transactional public Mono insertDocuments() @Deprecated public ReactiveSessionScoped inTransaction()

Slide 17

Slide 17 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD Summary & Outlook 17 Transactions are multi-document, multi-collection, conversational. They fit in well to existing Spring transaction paradigms.


Slide 18

Slide 18 text

> Stay Connected. MongoDB 4.0 & SpringData Lovelace Releases are out now!
 Get started with Spring Boot 2.1.M4. https://www.mongodb.com/transactions http://projects.spring.io/spring-data-mongodb/

Slide 19

Slide 19 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Safe Harbor Statement The following is intended to outline the general direction of Pivotal's offerings. It is intended for information purposes only and may not be incorporated into any contract. Any information regarding pre-release of Pivotal offerings, future updates or other planned modifications is subject to ongoing evaluation by Pivotal and is subject to change. This information is provided without warranty or any kind, express or implied, and is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions regarding Pivotal's offerings. These purchasing decisions should only be based on features currently available. The development, release, and timing of any features or functionality described for Pivotal's offerings in this presentation remain at the sole discretion of Pivotal. Pivotal has no obligation to update forward looking information in this presentation. 19