What’s mongod doing?
I am just learning how to debug mongod server issues. I know now I can use db.currentOp() to check this in the future.
What version? What OS release?
mongod v5.0.14
Ubuntu 20.04.5 LTS
As the issue is still happening I examined the output of db.currentOp() and I think the following query is probably the culprit. Looking at the rid reveals that there are only a few hundred records which match but for some reason the dbms doesn’t use that index, but instead uses only the full text search? I might be misreading the output here. Is there a simple change I can make to get this query to perform normally? I also don’t understand why the plansummary seems to include the same index over and over again.
type: 'op',
host: 'chat:27017',
desc: 'conn41',
connectionId: 41,
client: '127.0.0.1:53152',
clientMetadata: {
driver: { name: 'nodejs', version: '4.3.1' },
os: {
type: 'Linux',
name: 'linux',
architecture: 'x64',
version: '5.4.0-144-generic'
},
platform: 'Node.js v14.19.3, LE (unified)|Node.js v14.19.3, LE (unified)'
},
active: true,
currentOpTime: '2023-03-07T09:41:07.276-05:00',
effectiveUsers: [ { user: 'rocketchat', db: 'admin' } ],
threaded: true,
opid: 13676,
lsid: {
id: new UUID("bcbe2f99-cdf9-4c09-bca3-c8f3d175a374"),
uid: Binary(Buffer.from("56bb3afa50a12c12bd55cb8cc97243c1cc61c311a559ffab86114c472d35e7d4", "hex"), 0)
},
secs_running: Long("536"),
microsecs_running: Long("536208026"),
op: 'query',
ns: 'rocketchat.rocketchat_message',
command: {
find: 'rocketchat_message',
filter: {
'$text': {
'$search': 'https://example.com/path/index.php?type=test'
},
t: { '$ne': 'rm' },
_hidden: { '$ne': true },
rid: 'LkgTmX2dCncp5Rxtcx2Hj2YYiyyK49zj9i'
},
sort: { ts: -1 },
projection: { score: { '$meta': 'textScore' } },
skip: 0,
limit: 10,
lsid: { id: new UUID("bcbe2f99-cdf9-4c09-bca3-c8f3d175a374") },
'$clusterTime': {
clusterTime: Timestamp({ t: 1678199528, i: 1 }),
signature: {
hash: Binary(Buffer.from("222888b20decf0073dbf33332c7f1236a7473034", "hex"), 0),
keyId: Long("7176963756902055940")
}
},
'$db': 'rocketchat',
'$readPreference': { mode: 'secondaryPreferred' }
},
planSummary: 'IXSCAN { _fts: "text", _ftsx: 1 }, IXSCAN { _fts: "text", _ftsx: 1 }, IXSCAN { _fts: "text", _ftsx: 1 }, IXSCAN { _fts: "text", _ftsx: 1 }, IXSCAN { _fts: "text", _ftsx: 1 }, IXSCAN { _fts: "text", _ftsx: 1 }, IXSCAN { _fts: "text", _ftsx: 1 }, IXSCAN { _fts: "text", _ftsx: 1 }, IXSCAN { _fts: "text", _ftsx: 1 }',
numYields: 27991,
locks: { FeatureCompatibilityVersion: 'r', Global: 'r' },
waitingForLock: false,
lockStats: {
FeatureCompatibilityVersion: { acquireCount: { r: Long("27993") } },
ReplicationStateTransition: { acquireCount: { w: Long("1") } },
Global: { acquireCount: { r: Long("27993") } },
Database: { acquireCount: { r: Long("1") } },
Collection: { acquireCount: { r: Long("1") } },
Mutex: { acquireCount: { r: Long("2") } }
},
waitingForFlowControl: false,
flowControlStats: {}
}