Docs Menu
Docs Home
/
MongoDB Manual
/ / /

sp.listStreamProcessors()

On this page

  • Definition
  • Syntax
  • Command Fields
  • Behavior
  • Access Control
  • Example
  • Learn More
sp.listStreamProcessors()

Returns documents for each named Stream Processor on the current Stream Processing Instance. Each document provides descriptive information including the name, current state, and pipeline of a stream processor.

You can only invoke this command while connected to a stream processing instance.

This command requires mongosh version ≥ 2.0.

The sp.listStreamProcessors() method has the following syntax:

sp.listStreamProcessors(
{
<filter>
}
)

sp.listStreamProcessors() takes these fields:

Field
Type
Necessity
Description
filter
document
Optional
Document specifying which fields to filter stream processors on. If you provide a filter, the command will only return those processors which match the values for all the fields you specify.

sp.listStreamProcessors() returns documents describing all of the named stream processors on the current stream processing instance to STDOUT.

The user running sp.listStreamProcessors() must have the atlasAdmin role.

The following example shows an expected response from sp.listStreamProcessors() when the command is called without any filter:

sp.listStreamProcessors()
1{
2 id: '0135',
3 name: "proc01",
4 last_modified: ISODate("2023-03-20T20:15:54.601Z"),
5 state: "RUNNING",
6 error_msg: '',
7 pipeline: [
8 {
9 $source: {
10 connectionName: "myKafka",
11 topic: "stuff"
12 }
13 },
14 {
15 $match: {
16 temperature: 46
17 }
18 },
19 {
20 $emit: {
21 connectionName: "mySink",
22 topic: "output",
23 }
24 }
25 ],
26 lastStateChange: ISODate("2023-03-20T20:15:59.442Z")
27},
28{
29 id: '0218',
30 name: "proc02",
31 last_modified: ISODate("2023-03-21T20:17:33.601Z"),
32 state: "STOPPED",
33 error_msg: '',
34 pipeline: [
35 {
36 $source: {
37 connectionName: "myKafka",
38 topic: "things"
39 }
40 },
41 {
42 $match: {
43 temperature: 41
44 }
45 },
46 {
47 $emit: {
48 connectionName: "mySink",
49 topic: "results",
50 }
51 }
52 ],
53 lastStateChange: ISODate("2023-03-21T20:18:26.139Z")
54}

The following example shows an expected response if you invoke sp.listStreamProcessors() filtering for only those stream processors with a state of running.

sp.listStreamProcessors({"state": "running"})
1{
2 id: '0135',
3 name: "proc01",
4 last_modified: ISODate("2023-03-20T20:15:54.601Z"),
5 state: "RUNNING",
6 error_msg: '',
7 pipeline: [
8 {
9 $source: {
10 connectionName: "myKafka",
11 topic: "stuff"
12 }
13 },
14 {
15 $match: {
16 temperature: 46
17 }
18 },
19 {
20 $emit: {
21 connectionName: "mySink",
22 topic: "output",
23 }
24 }
25 ],
26 lastStateChange: ISODate("2023-03-20T20:15:59.442Z")
27}
  • Manage Stream Processors

Back

sp.listConnections