简体   繁体   中英

TypeError: Cannot read properties of undefined (reading 'watch')

IN my NodeJS I want to watch a collection in MongoDB Atlas

const changeStream = collections_saga.createOrg.watch(pipeline);

results in TypeError: Cannot read properties of undefined (reading 'watch')

 "dependencies": {
    "@types/jsonwebtoken": "^8.5.6",
    "@types/morgan": "^1.9.3",
    "axios": "^0.25.0",
    "colors": "^1.4.0",
    "cors": "^2.8.5",
    "dotenv": "^10.0.0",
    "express": "^4.17.1",
    "helmet": "^4.6.0",
    "jwt-decode": "^3.1.2",
    "mongodb": "^4.2.0",
    "morgan": "^1.10.0",
    "winston": "^3.3.3"
  },
  "devDependencies": {
    "@shelf/jest-mongodb": "^2.2.0",
    "@types/cors": "^2.8.12",
    "@types/dotenv": "^8.2.0",
    "@types/express": "^4.17.13",
    "@types/helmet": "^4.0.0",
    "@types/jest": "^27.0.3",
    "@types/mongodb": "^4.0.7",
    "@types/node": "^16.11.10",
    "@types/request": "^2.48.8",
    "@types/supertest": "^2.0.11",
    "jest": "^27.4.5",
    "supertest": "^6.1.6",
    "ts-jest": "^27.1.2",
    "ts-node-dev": "^1.1.8",
    "typedoc": "^0.22.10",
    "typescript": "^4.5.2"
  }

Any Idea why?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM