Updated on 2024-08-29 GMT+08:00

Command Query

DAS manages database collections and views through SQL statements, facilitating user operations.

Precautions

  • The timestampe() command is not supported.
  • The db.collection.aggregate() command is not supported. You can run the db.runCommand command instead. The following is an example about how to use syntax:
    db.runCommand({
    	aggregate: "collection",
    	pipeline: [{
    			"$match": {
    				"time": {
    					"$gte": 20.0
    				}
    			}
    		},
    		{
    			"$sort": {
    				"time": -1.0
    			}
    		}
    	]
    });

Procedure

  1. Log in to the DAS console.
  2. Click in the upper left corner and select a region and project.
  3. Click in the upper left corner, and under Databases, click Data Admin Service.
  4. In the navigation pane on the left, choose Development Tool.

    You can also click Go to Development Tool on the overview page.

  5. Locate the DB instance that you want to log in to and click Log In in the Operation column.
  6. On the top menu bar, choose Command Operation > Command Window.
  7. In the displayed text box, enter the commands you want to execute and click Execute Command.

    Figure 1 Executing a command

    You can also perform the operations listed in Table 1 on the command query page.

    Table 1 Function description

    Function

    Description

    Executing Command

    Executes commands.

    Commands are performed on collections and views in a database.

    Full Screen

    Shows commands on a full screen.

    Save Executed Commands

    After this function is enabled, the system saves the recently executed commands to the server.

    Executed Commands

    Shows the command execution details.

    Messages

    Shows the command output.

    Result Set

    Shows the command execution result.

    Overwrite/Append Mode

    • Append Mode: Each time a command is executed, the new result set is appended to the previous one.
    • Overwrite Mode: Each time a command is executed, the new result set overwrites the previous one.

    Export of the query result set

    Used to export the query result set. A maximum of 1000 records can be exported at a time.