Servidor Couchbase

Comparação dos recursos do MongoDB MQL com o N1QL no Couchbase 6.5

Esta é uma breve nota que analisa os recursos da linguagem MQL do MongoDB destacados no blog de lançamento: MongoDB 4.4: Engenharia orientada ao usuário. Pronto para você. A versão 4.4 do MongoDB adicionou vários recursos para a linguagem MQL. O Couchbase lançou a versão 6.5 no início do ano com um número significativo de recursos no N1QL, tanto para o serviço de consulta quanto para o serviço de análise. Vamos nos aprofundar no assunto.

MongoDB 4.4 Couchbase 6.5
Liberado GA: julho de 2020 GA: janeiro de 2020
O que há de novo? https://www.mongodb.com/collateral/mongodb-4.4-guide https://docs.couchbase.com/server/current/introduction/whats-new.html
Operação do conjunto UNION 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/
Expressões de agregação personalizadas 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.
Pesquisa 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.
Transações 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.

Recursos:

  1. Documentos do Couchbase
  2. Tutorial N1QL
  3. Documentos do MongoDB
Compartilhe este artigo
Receba atualizações do blog do Couchbase em sua caixa de entrada
Esse campo é obrigatório.

Author

Posted by Keshav Murthy

Keshav Murthy is a Vice President at Couchbase R&D. Previously, he was at MapR, IBM, Informix, Sybase, with more than 20 years of experience in database design & development. He lead the SQL and NoSQL R&D team at IBM Informix. He has received two President's Club awards at Couchbase, two Outstanding Technical Achievement Awards at IBM. Keshav has a bachelor's degree in Computer Science and Engineering from the University of Mysore, India, and has received twenty four US patents.

Deixe um comentário

Pronto para começar a usar o Couchbase Capella?

Iniciar a construção

Confira nosso portal do desenvolvedor para explorar o NoSQL, procurar recursos e começar a usar os tutoriais.

Use o Capella gratuitamente

Comece a trabalhar com o Couchbase em apenas alguns cliques. O Capella DBaaS é a maneira mais fácil e rápida de começar.

Entre em contato

Deseja saber mais sobre as ofertas do Couchbase? Deixe-nos ajudar.