Updated on 2024-04-25 GMT+08:00

Database: MongoDBQuery

This system keyword is used for query operations on the MongoDB database. A maximum of 100 records can be queried in the system.

Parameter

Mandatory

Type

Description

Ip

Yes

String

Database IP address

Port

Yes

Integer

Database port

User Name

Yes

String

Username

Password

Yes

String

Password (The login password is personal information and must be defined as sensitive in the environment parameters.)

DB Name

Yes

String

Database instance name

Collection

Yes

String

Collection name

Query

No

String

Query conditions (data in BSON format). By default, this parameter is left blank to query all data in the collection. A maximum of 100 records can be queried in the system.

Limit

No

Integer

  • Maximum number of records in the query result. By default, this parameter is left blank to query all data in the collection. A maximum of 100 records can be queried in the system.
  • If the value is a number out the range of 0 to 100, a maximum of 100 records can be queried in the system.

MongoDBQuery Response

Status: success

Parameter

Type

Description

[Array elements]

Array of row objects

Structure returned by the query result list

Parameter Description

Parameter

Type

Description

field1

String

Database field 1

field2

Integer

Database field 2

...

String

Database field n

MongoDBQuery Response Example

[ {
  "_id" : {
    "$oid" : "62465c42907c00003d0076fe"
  },
  "title" : "MongoDB Tutorial",
  "description" : "MongoDB is a NoSQL database.",
  "by" : "test",
  "url" : "",
  "tags" : [ "mongodb", "database", "NoSQL" ],
  "likes" : 100.0
}, {
  "_id" : {
    "$oid" : "62465ce4907c00003d0076ff"
  },
  "title" : "PHP Tutorial",
  "description" : "PHP is a powerful server-side scripting language for creating dynamic interactive sites.",
  "by" : "test",
  "url" : "",
  "tags" : [ "php" ],
  "likes" : 200.0
}, {
  "_id" : {
    "$oid" : "62465ce8907c00003d007700"
  },
  "title" : "Java Tutorial",
  "description" : "Java is a high-level programming language launched by Sun Microsystems in May 1995.",
  "by" : "test",
  "url" : "",
  "tags" : [ "java" ],
  "likes" : 150.0
} ]

MongoDBQuery Usage Example

  • Query the number of documents in the database collection. The system returns the document data list based on the system keyword. You can determine the returned result based on the service.

    You can determine the result based on the returned list. For example, the number of documents in the collection is 10.

  • Query user data and extract data. The queried data list is returned.

    Extract or determine the result from response information.