이 글은 릴리즈 블로그에서 강조된 MongoDB MQL 언어 기능을 간략하게 검토한 글입니다: MongoDB 4.4: 사용자 중심 엔지니어링. 준비 완료. MongoDB 4.4 릴리스에는 MQL 언어에 대한 여러 가지 기능이 추가되었습니다. 카우치베이스 6.5 출시 쿼리 서비스 및 분석 서비스 모두에서 N1QL의 상당수 기능을 올해 초에 발표했습니다. 자세히 살펴보겠습니다.
| MongoDB 4.4 | Couchbase 6.5 | |
|---|---|---|
| 출시 | GA: 2020년 7월 | GA: 2020년 1월 |
| 새로운 기능은 무엇인가요? | https://www.mongodb.com/collateral/mongodb-4.4-guide | https://docs.couchbase.com/server/current/introduction/whats-new.html |
| 유니온 세트 작업 |
Introduces $UnionWith aggregation pipeline stage to bend data into a single result set. Roughly equivalent to UNION ALL set operation in SQL. https://docs.mongodb.com/master/reference/operator/aggregation/unionWith/#pipe._S_unionWith |
Supports all SQL set operations since the initial release: UNION, UNION ALL, EXCEPT, EXCEPT ALL, INTERSECT, INTERSECT ALL. The ALL modifier returns duplicate documents. Using the operation without ALL avoids the sort stage required in the MQL aggregation pipeline. These set operations can be used anywhere a SELECT query is used (subqueries, derived tables, etc). https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/union.html https://blog.jooq.org/2015/10/06/you-probably-dont-use-sql-intersect-or-except-often-enough/ |
| 사용자 지정 집계 표현식 |
Introduces $function, allowing JavaScript snippets inside the aggregation pipeline to customize processing. User-defined aggregations can be created using $accumulate, $function, $merge, and $group. This approach is verbose and must be rewritten for every query. In SQL, once a user-defined aggregate is created, it can be reused like any other aggregate. Other improvements include simple scalar functions. https://docs.mongodb.com/master/release-notes/4.4/#custom-aggregation-expressions |
Preview release of SQL functions and JavaScript functions usable anywhere expressions are allowed in N1QL. These can be part of complex queries and are expected to be GA in the next major release. MongoDB still lacks window functions, which were released in Couchbase 6.5 and significantly improve developer productivity. Couchbase supports JavaScript-based aggregation via map-reduce views, though they are not accessible through N1QL. Couchbase Eventing functions are also written in JavaScript and provide a scalable infrastructure for modern applications. |
| 검색 |
Introduces full-text $search based on Lucene, available only in MongoDB Atlas. MongoDB itself has limited search functionality and is not Lucene-based. $search can only be used as the first stage of an aggregation pipeline and cannot be used in updates or deletes. |
Couchbase 6.5 introduced the SEARCH() function and related metadata functions. It supports simple string search to full-text search with deep integration into the N1QL optimizer. |
| 거래 |
Introduces the ability to create collections and indexes within a non-sharded transaction. Using DDLs inside transactions is still rare. |
Released distributed transactions for Java SDKs, allowing applications to operate on multiple documents using get/set APIs. Distributed transactions are not supported for N1QL statements. |
리소스: