JSON commands

You submit Db2® JSON commands in the command-line interface by using a prefix that specifies the scope of the command. Prefix the command name first with a namespace and then, if applicable, a collection name.

To work with the current namespace, prefix the command with db. For example, if you set the namespace as MEDIA by specifying the USE command, the db.getCollectionNames() command returns the names of the collections in the MEDIA namespace.

To work with a specific collection and its documents, prefix the command with db.collectionname. For example, the db.books.count() command returns the number of documents in the BOOKS collection in the current namespace.