skip to content
Alvin Lucillo

Check running operations in mongodb server

/ 2 min read

To check the running operations in mongodb server, run the aggregation stage $currentOp. Using db.currentOp() or the currentOp command is deprecated.

currentOp shows active queries and any active work. There’s not much in the sample operations, just standard threads of mongodb processes and topology monitoring by mongosh.

db.aggregate([{ $currentOp: {} }]);
[
	({
		type: "op",
		host: "mongo-demo:27017",
		desc: "JournalFlusher",
		active: true,
		currentOpTime: "2026-04-26T13:35:51.369+00:00",
		opid: 36495,
		op: "none",
		ns: "",
		redacted: false,
		command: {},
		numYields: 0,
		locks: {},
		waitingForLock: false,
		lockStats: {},
		waitingForFlowControl: false,
		flowControlStats: {},
	},
	{
		type: "op",
		host: "mongo-demo:27017",
		desc: "conn13",
		connectionId: 13,
		client: "192.0.2.10:37964",
		appName: "mongosh 2.x",
		clientMetadata: {
			application: { name: "mongosh 2.x" },
			driver: { name: "nodejs|mongosh", version: "6.x|2.x" },
			platform: "Node.js v20.x, LE",
			os: {
				name: "linux",
				architecture: "x64",
				version: "<redacted>",
				type: "Linux",
			},
		},
		active: true,
		currentOpTime: "2026-04-26T13:35:51.369+00:00",
		threaded: true,
		opid: 36395,
		secs_running: Long("8"),
		microsecs_running: Long("8089157"),
		op: "command",
		ns: "admin.$cmd",
		redacted: false,
		command: {
			hello: 1,
			maxAwaitTimeMS: 10000,
			topologyVersion: {
				processId: ObjectId("000000000000000000000000"),
				counter: Long("0"),
			},
			$db: "admin",
		},
		numYields: 0,
		locks: {},
		waitingForLock: false,
		lockStats: {},
		waitingForFlowControl: false,
		flowControlStats: {},
	},
	{
		type: "op",
		host: "mongo-demo:27017",
		desc: "conn17",
		connectionId: 17,
		client: "192.0.2.11:37992",
		appName: "mongosh 2.x",
		clientMetadata: {
			application: { name: "mongosh 2.x" },
			driver: { name: "nodejs|mongosh", version: "6.x|2.x" },
			platform: "Node.js v20.x, LE",
			os: {
				name: "linux",
				architecture: "x64",
				version: "<redacted>",
				type: "Linux",
			},
		},
		active: true,
		currentOpTime: "2026-04-26T13:35:51.369+00:00",
		threaded: true,
		opid: 36496,
		lsid: {
			id: UUID("00000000-0000-0000-0000-000000000000"),
			uid: Binary.createFromBase64("<redacted>", 0),
		},
		secs_running: Long("0"),
		microsecs_running: Long("113"),
		op: "command",
		ns: "admin.$cmd.aggregate",
		redacted: false,
		command: {
			aggregate: 1,
			pipeline: [{ $currentOp: {} }],
			cursor: {},
			lsid: { id: UUID("00000000-0000-0000-0000-000000000000") },
			$db: "admin",
		},
		queryFramework: "classic",
		numYields: 0,
		locks: {},
		waitingForLock: false,
		lockStats: {},
		waitingForFlowControl: false,
		flowControlStats: {},
	},
	{
		type: "op",
		host: "mongo-demo:27017",
		desc: "Checkpointer",
		active: true,
		currentOpTime: "2026-04-26T13:35:51.369+00:00",
		opid: 36273,
		op: "none",
		ns: "",
		redacted: false,
		command: {},
		numYields: 0,
		locks: {},
		waitingForLock: false,
		lockStats: {},
		waitingForFlowControl: false,
		flowControlStats: {},
	}),
];