<< Click to Display Table of Contents >> Navigation: 5. Detailed description of the Actions > 5.23. Cloud services > 5.23.76. Download JSON from a MongoDB Server |
Icon:
Function: MongoDBRead
Property window:
Short description:
Download JSON from a MongoDB server.
Long Description:
Before using this Action, you need to install the Additional Components that runs the MongoDB connection: click on the link in the parameter P6.
The parameter P1 is the “Server URI” to connect to your MongoDB server. If you are already using the “MongoDB Compass” tool, that’s exactly the same “Server URI”: You can directly copy/paste it into Anatella. The structure of this URI is:
mongodb://<username>:<password>@<servername>:<port>/<authorizationDB>?<options>
The server URI for an authenticated connection (with a login/password) typically looks like:
mongodb://myLogin:myPass@192.168.1.200:27017/test?authMechanism=SCRAM-SHA-1
You’ll find more details on the syntax of the parameter P1 here:
https://docs.mongodb.com/manual/reference/connection-string/
As soon as you have defined the parameter P1, Anatella automatically fills-in the combo box for the parameters P2 and P3. To extract the whole collection inside a MongoDB server, just let the parameter P5 empty and set the parameter P4=“Find”.
The value of the parameter P5 can either be a “filter expression” or an “aggregate expression” (depending on the value of the parameter P4). Here is an example of “filter expression” (parameter P5) that returns all the JSON documents that contains an attribute named “myInt” whose value is lower than 25:
{"myInt":{"$lt":25}}
The syntax of the “filter expression” (parameter P5) is the syntax of the “filter” property described here:
https://docs.mongodb.com/manual/reference/command/find/
Here is an example of “aggregate expression” (parameter P5) that computes a “count” aggregate :
{ "pipeline":
[
{"$group":
{
"_id": null,
"count": {"$sum":1}
}
}
]
}
The syntax of the “aggregate expression” (parameter P5) is described here:
https://docs.mongodb.com/manual/reference/command/aggregate/