Compatibility and limits

更新时间:
复制 MD 格式

The document compatibility feature of PolarDB for PostgreSQL is highly compatible with document database syntax and drivers. Before you use this feature or migrate data, read this chapter carefully to understand the scope of compatibility, limits, and behavioral differences to ensure that your services run smoothly and stably.

Scope

  • Compatible versions: This feature is compatible with drivers and clients for MongoDB 4.0 and later. This feature does not support commands deprecated in versions earlier than MongoDB 4.0, such as mapreduce. Upgrade your client or driver to a compatible version.

  • Error codes: The document compatibility feature of PolarDB for PostgreSQL uses the same error names and codes as MongoDB. However, the specific error messages may differ.

  • Character sets: For the document compatibility feature of PolarDB for PostgreSQL, collection names must be valid UTF-8. MongoDB allows invalid UTF-8, but this feature does not.

Supported drivers and client tools

This feature supports official MongoDB drivers for most major programming languages and common client tools.

Official driver support

Language

Driver/Library

Python

pymongo

Go

mongo-go-driver

JavaScript (Node.js)

mongodb/Mongoose

Java

MongoDB Java

Rust

mongodb

C

mongo-c-driver

C++

mongo-cxx-driver

PHP

mongodb (extension) + library (user mode)

Ruby

mongo

Scala

mongodb-scala-driver

Swift

mongo-swift-driver

Client tool support

You can connect to and manage the database using standard MongoDB client tools.

  • mongosh

  • Studio 3T

Command compatibility matrix

The following tables show the support status for different types of MongoDB commands.

Aggregation commands

Command

Support status

aggregate

Supported

count

Supported

distinct

Supported

Query and write commands

Command

Support status

find

Supported

insert

Supported

update

Supported

delete

Supported

findAndModify

Supported

getMore

Supported

bulkWrite

Not supported

O&M commands

Command

Support status

create

Supported

drop

Supported

createIndexes

Supported

dropIndexes

Supported

listCollections

Supported

listDatabases

Supported

listIndexes

Supported

collMod

Supported

compact

Supported

reIndex

Supported

renameCollection

Supported

currentOp

Supported

killCursors

Supported

getParameter

Supported

cloneCollectionAsCapped

Not supported

convertToCapped

Not supported

dropConnections

Not supported

killOp

Not supported

logRotate

Not supported

setParameter

Not supported

shutdown

Not supported

Diagnostic commands

Command

Support status

buildInfo

Supported

collStats

Supported

connectionStatus

Supported

dataSize

Supported

dbStats

Supported

explain

Supported

ferretDebugError

Supported

getCmdLineOpts

Supported

getLog

Supported

hostInfo

Supported

listCommands

Supported

ping

Supported

serverStatus

Supported

validate

Supported

whatsmyuri

Supported

connPoolStats

Not supported

logApplicationMessage

Not supported

profile

Not supported

Session commands

Command

Support status

abortTransaction

Supported

commitTransaction

Supported

endSessions

Supported

killAllSessions

Supported

killSessions

Supported

refreshSessions

Supported

startSession

Supported

killAllSessionsByPattern

Not supported

User management commands

Command

Support status

createUser

Supported

dropAllUsersFromDatabase

Supported

dropUser

Supported

updateUser

Supported

usersInfo

Supported

grantRolesToUser

Not supported

revokeRolesFromUser

Not supported