WSO2 DSS support for mongodb 3.x.x

2019-08-12 23:18发布

问题:

I was trying to incorporate WSO2 DSS 3.5.0 with Mongodb 3.2.1;

I found out that the functions exposed by the .dbs file are very limited compared to the mongo shell

for example:

the famous

db.collection.FindAndModify() 

is not supported;

nested usage of mongodb shell command as following

db.collection.remove({_id: $BinData(3, #)}

can not be parsed

I googled around and found a ds-connector-mongodb(with mongo-java-driver-2.9.0, and jongo 0.3) on Github

I checkd the DSS 3.5.0 bundles under "/repository/components/plugins", and found "mongo-java-driver_3.0.0.wso2v2.jar" ...

I am totally confused about how mongodb is supported on WSO2 DSS 3.5

Had the "ds-connector-mongodb" been deprecated? or had there it been a new structure/frame or what?

not to mention there were compatibility problems between the 2.x.x and 3.x.x of mongo-java-drive ...

please advice thanks

回答1:

For mongodb support the currently supported operations are available under MongoOperationLabels in [2] for other specific operations such as "db.collection.FindAndModify() custom operations will have to be written extending the current code base by extending[1]

[1]https://github.com/wso2/wso2-dss-connectors/blob/master/mongodb/src/main/java/org/wso2/dss/connectors/mongodb/MongoDBDataSource.java

[2] https://github.com/wso2/wso2-dss-connectors/blob/master/mongodb/src/main/java/org/wso2/dss/connectors/mongodb/MongoDBDSConstants.java

The currently available operations are as below COUNT, DROP, FIND, FIND_ONE, INSERT, REMOVE, UPDATE

The documentation[3] explains how a data source can be created using the WSO2 Data Services Server. Hear please note that the Servers can be specified as a comma separated list of server hosts and ports as: "localhost" - "125.10.5.3, 125.10.5.4" - "192.168.3.1:27017, 192.168.3.2:27017"

The Auto Connect Retry is used to controls whether or not to connect. when the system retries to connect automatically.

You may also find [4] which is a sample that explains how operations such as createCollection can be used

[4]https://docs.wso2.com/display/DSS320/MongoDB+Sample

[3]https://docs.wso2.com/display/DSS320/MongoDB regards,shavantha