{"_id":"@casbin/mongo-changestream-watcher","_rev":"8-b4f4a0bf7dab015d6afa9e9131dcd436","name":"@casbin/mongo-changestream-watcher","dist-tags":{"latest":"1.3.0"},"versions":{"1.0.0":{"name":"@casbin/mongo-changestream-watcher","version":"1.0.0","keywords":["casbin","node-casbin","watcher","mongodb"],"author":{"name":"Node-Casbin"},"_id":"@casbin/mongo-changestream-watcher@1.0.0","maintainers":[{"name":"chalin","email":"18875906195@163.com"},{"name":"hsluoyz","email":"hsluoyz@gmail.com"},{"name":"nodece","email":"nodeces@gmail.com"},{"name":"zxilly","email":"zxilly@outlook.com"}],"contributors":[{"url":"https://github.com/Sefriol","name":"Joakim Järvinen","email":"Sefriol@users.noreply.github.com"}],"homepage":"https://github.com/node-casbin/mongo-changestream-watcher","bugs":{"url":"https://github.com/node-casbin/mongo-changestream-watcher/issues"},"dist":{"shasum":"5aeee041962aeea8ca752ef31b60ea2fff5347f8","tarball":"https://registry.npmjs.org/@casbin/mongo-changestream-watcher/-/mongo-changestream-watcher-1.0.0.tgz","fileCount":38,"integrity":"sha512-nYyH0EwYfafWCsIh1YOI67cVhokRnQ2TYS+ToWmx+qq1CUiecTxYBHYVrwjNYC2NRvmGKVkV0m+avd61wlWdXQ==","signatures":[{"sig":"MEQCIFM2jjiMf3OTAZUI24RcSVZ2LPQd5o+wNF5kxKXvb2bgAiAgm+4my2rdne7giXx6yfmFTgUWv3/OMP1+J605DHjoaQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":51281,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjCNDgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpFrw//cfyH0MjPt/vyArNPKG+eJDAQvPmqOejk3AyCEa/jn1URcEDl\r\nS3ja9XCeXmBa1ZwyYdF5c4YKMGHfd9qlAyJNBJHU6/PNoT0EfRQlcH/X1N+l\r\n5jPma+xedXpCpLeC1sqQtUMNiYfW7N9aivVYGEk8OcpWcngVbOb22TttxSlJ\r\nsbV+WBvv6Bq/8C70JHzwwNStae0Aw8BXQBIb7qc367LqE1XFUCnUmQFWotW8\r\nwt12emPiUigW1Zc1u/xrr517CTs4zKkOQPUXT5irrL+BOq0fPqyWnfa/ku3g\r\nZgVG34GlQbg5KrIMRneaxSEDx7AWUI3Iw06PjeBOlokZ96JVJdazJSRMusWQ\r\n84kjRAZfVZBTPSpU0NaNUDZk8x65YrCTRIMYjFXNLxH+DMCIe5XgWZtGBG4o\r\nFPgUwuvDK2c2Hjcvg9JOo8uIrV/7tFai7vpceqrsC/8ftBLNXl3j0sUEUA7p\r\n/fX9UXAZYiXwPQAjo8JhyQM5SHRlP4Ic54uBc1O6lvyxye5qZdtRcGcuiUYj\r\nTENXQh9+c2jMN0D6I9HKPc+uBrVVszRQOkWQvUa35KcM6+GWkwDnRT8VHyE+\r\nWFwODhZ28l05RPw0C4RcNC7eBwcmbCSEa58CaW8JCcR0ydBZoClQloewJOac\r\n/xXHx+AJ7IqVtTa90VLiMtmOPVVY8nnj8hE=\r\n=KeAV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/cjs/watcher.js","config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"module":"lib/esm/watcher.js","engines":{"node":">=14.0.0"},"gitHead":"748a81b839e93d89e2352a8df851dcd1756d803d","scripts":{"fmt":"eslint . --ext .js,.ts --fix","lint":"eslint . --ext .js,.ts","test":"jest","build":"run-s clean && run-p build:*","clean":"rimraf lib","prepare":"npm run build && husky install","coverage":"jest --coverage","postpack":"run-s clean","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","prepublishOnly":"npm run lint","semantic-release":"semantic-release"},"typings":"lib/cjs/watcher.d.ts","_npmUser":{"name":"hsluoyz","email":"hsluoyz@gmail.com"},"licenses":[{"url":"http://www.apache.org/licenses/LICENSE-2.0","type":"Apache-2.0"}],"repository":{"url":"git+https://github.com/node-casbin/mongo-changestream-watcher.git","type":"git"},"_npmVersion":"8.11.0","description":"Casbin Watcher based on MongoDB Change Streams","directories":{"test":"test","example":"examples"},"_nodeVersion":"16.16.0","dependencies":{"mongodb":"^4.8.1"},"publishConfig":{"tag":"latest","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^28.1.3","husky":"^8.0.0","sinon":"^14.0.0","casbin":"^5.16.0","eslint":"^8.22.0","ts-jest":"^28.0.8","coveralls":"^3.1.1","typescript":"^4.7.4","@types/jest":"^28.1.7","npm-run-all":"^4.1.5","eslint-plugin-n":"^15.2.4","jsdoc-to-markdown":"^7.1.1","eslint-plugin-jest":"^26.8.7","eslint-plugin-node":"^11.1.0","eslint-plugin-import":"^2.26.0","eslint-plugin-promise":"^6.0.0","eslint-config-standard":"^17.0.0","casbin-mongoose-adapter":"^5.1.0","cz-conventional-changelog":"^3.3.0","@typescript-eslint/eslint-plugin":"^5.33.1","eslint-config-standard-with-typescript":"^22.0.0"},"peerDependencies":{"casbin":"^5.16.0"},"_npmOperationalInternal":{"tmp":"tmp/mongo-changestream-watcher_1.0.0_1661522144629_0.037231272784469915","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@casbin/mongo-changestream-watcher","version":"1.1.0","keywords":["casbin","node-casbin","watcher","mongodb"],"author":{"name":"Node-Casbin"},"_id":"@casbin/mongo-changestream-watcher@1.1.0","maintainers":[{"name":"chalin","email":"18875906195@163.com"},{"name":"hsluoyz","email":"hsluoyz@gmail.com"},{"name":"nodece","email":"nodeces@gmail.com"},{"name":"zxilly","email":"zxilly@outlook.com"}],"contributors":[{"url":"https://github.com/Sefriol","name":"Joakim Järvinen","email":"Sefriol@users.noreply.github.com"}],"homepage":"https://github.com/node-casbin/mongo-changestream-watcher","bugs":{"url":"https://github.com/node-casbin/mongo-changestream-watcher/issues"},"dist":{"shasum":"aa17b575ff9a1e879f8a49f70e40db0b9c059f58","tarball":"https://registry.npmjs.org/@casbin/mongo-changestream-watcher/-/mongo-changestream-watcher-1.1.0.tgz","fileCount":33,"integrity":"sha512-26h8BIFSphkdikPb8Pf281LpOQWjO1iLygEO72OyK0eA8LpqmxnqfW27lLn8e2SS+hqo8kPfTN25Y58tXs5AZQ==","signatures":[{"sig":"MEQCIHVikEOf2Kg2/dCJsUjQq8oePA7hgK3dEMlD3X7OjHJIAiAmR8s15HwZHy2Byz/ttYebI1sgekQLEEW2hwSXeGa5Hw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":50940},"main":"lib/cjs/watcher.js","config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"module":"lib/esm/watcher.js","engines":{"node":">=14.0.0"},"gitHead":"5d2f009f4f56b9c4c1f9c44d3dad6121aabd1d4b","scripts":{"fmt":"eslint . --ext .js,.ts --fix","lint":"eslint . --ext .js,.ts","test":"jest","build":"run-s clean && run-p build:*","clean":"rimraf lib","prepare":"npm run build && husky install","coverage":"jest --coverage","postpack":"run-s clean","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","prepublishOnly":"npm run lint","semantic-release":"semantic-release"},"typings":"lib/cjs/watcher.d.ts","_npmUser":{"name":"hsluoyz","email":"hsluoyz@gmail.com"},"licenses":[{"url":"http://www.apache.org/licenses/LICENSE-2.0","type":"Apache-2.0"}],"repository":{"url":"git+https://github.com/node-casbin/mongo-changestream-watcher.git","type":"git"},"_npmVersion":"9.5.1","description":"Casbin Watcher based on MongoDB Change Streams","directories":{"test":"test","example":"examples"},"_nodeVersion":"18.16.0","dependencies":{"mongodb":"^4.8.1"},"publishConfig":{"tag":"latest","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^28.1.3","husky":"^8.0.0","sinon":"^14.0.0","casbin":"^5.16.0","eslint":"^8.22.0","ts-jest":"^28.0.8","coveralls":"^3.1.1","typescript":"^4.7.4","@types/jest":"^28.1.7","npm-run-all":"^4.1.5","eslint-plugin-n":"^15.2.4","jsdoc-to-markdown":"^7.1.1","eslint-plugin-jest":"^26.8.7","eslint-plugin-node":"^11.1.0","eslint-plugin-import":"^2.26.0","eslint-plugin-promise":"^6.0.0","eslint-config-standard":"^17.0.0","casbin-mongoose-adapter":"^5.1.0","cz-conventional-changelog":"^3.3.0","@typescript-eslint/eslint-plugin":"^5.33.1","eslint-config-standard-with-typescript":"^22.0.0"},"peerDependencies":{"casbin":"^5.16.0"},"_npmOperationalInternal":{"tmp":"tmp/mongo-changestream-watcher_1.1.0_1683948837027_0.8031063302175871","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"@casbin/mongo-changestream-watcher","version":"1.1.1","keywords":["casbin","node-casbin","watcher","mongodb"],"author":{"name":"Node-Casbin"},"_id":"@casbin/mongo-changestream-watcher@1.1.1","maintainers":[{"name":"chalin","email":"18875906195@163.com"},{"name":"hsluoyz","email":"hsluoyz@gmail.com"}],"contributors":[{"url":"https://github.com/Sefriol","name":"Joakim Järvinen","email":"Sefriol@users.noreply.github.com"}],"homepage":"https://github.com/node-casbin/mongo-changestream-watcher","bugs":{"url":"https://github.com/node-casbin/mongo-changestream-watcher/issues"},"dist":{"shasum":"aab53552da2313e48b2816b2a9132e6f0f2a84b1","tarball":"https://registry.npmjs.org/@casbin/mongo-changestream-watcher/-/mongo-changestream-watcher-1.1.1.tgz","fileCount":33,"integrity":"sha512-CdsnX9YaVMF8R8k3diKXpDFfF3AkP3EJTckgvf4SxQphuFRbz9umuYr89DjnJQJULyHjmK2ICOkZHN+1Owm7KA==","signatures":[{"sig":"MEQCIFXWhuiZw/UFEi9kYyn7sLVp/1FVVi75ylZMHyTR05CbAiARZaeQNwN8Xeo18SBLM3nQVMtbCj0dja6Oli8wIFXYLA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":51317},"main":"lib/cjs/watcher.js","config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"module":"lib/esm/watcher.js","engines":{"node":">=14.0.0"},"gitHead":"f2a0edb277be7834dae3ad844f524cb1f0d26608","scripts":{"fmt":"eslint . --ext .js,.ts --fix","lint":"eslint . --ext .js,.ts","test":"jest","build":"run-s clean && run-p build:*","clean":"rimraf lib","prepare":"npm run build && husky install","coverage":"jest --coverage","postpack":"run-s clean","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","prepublishOnly":"npm run lint","semantic-release":"semantic-release"},"typings":"lib/cjs/watcher.d.ts","_npmUser":{"name":"hsluoyz","email":"hsluoyz@gmail.com"},"licenses":[{"url":"http://www.apache.org/licenses/LICENSE-2.0","type":"Apache-2.0"}],"repository":{"url":"git+https://github.com/node-casbin/mongo-changestream-watcher.git","type":"git"},"_npmVersion":"9.6.7","description":"Casbin Watcher based on MongoDB Change Streams","directories":{"test":"test","example":"examples"},"_nodeVersion":"18.17.0","dependencies":{"mongodb":"^4.8.1"},"publishConfig":{"tag":"latest","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^28.1.3","husky":"^8.0.0","sinon":"^14.0.0","casbin":"^5.16.0","eslint":"^8.22.0","ts-jest":"^28.0.8","coveralls":"^3.1.1","typescript":"^4.7.4","@types/jest":"^28.1.7","npm-run-all":"^4.1.5","eslint-plugin-n":"^15.2.4","jsdoc-to-markdown":"^7.1.1","eslint-plugin-jest":"^26.8.7","eslint-plugin-node":"^11.1.0","eslint-plugin-import":"^2.26.0","eslint-plugin-promise":"^6.0.0","eslint-config-standard":"^17.0.0","casbin-mongoose-adapter":"^5.1.0","cz-conventional-changelog":"^3.3.0","@typescript-eslint/eslint-plugin":"^5.33.1","eslint-config-standard-with-typescript":"^22.0.0"},"peerDependencies":{"casbin":"^5.16.0"},"_npmOperationalInternal":{"tmp":"tmp/mongo-changestream-watcher_1.1.1_1691372933625_0.11550635638512796","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"@casbin/mongo-changestream-watcher","version":"1.2.0","keywords":["casbin","node-casbin","watcher","mongodb"],"author":{"name":"Node-Casbin"},"_id":"@casbin/mongo-changestream-watcher@1.2.0","maintainers":[{"name":"hsluoyz","email":"hsluoyz@gmail.com"}],"contributors":[{"url":"https://github.com/Sefriol","name":"Joakim Järvinen","email":"Sefriol@users.noreply.github.com"}],"homepage":"https://github.com/node-casbin/mongo-changestream-watcher","bugs":{"url":"https://github.com/node-casbin/mongo-changestream-watcher/issues"},"dist":{"shasum":"9ced984abafca4361a0768198e29fadb8b3009bc","tarball":"https://registry.npmjs.org/@casbin/mongo-changestream-watcher/-/mongo-changestream-watcher-1.2.0.tgz","fileCount":33,"integrity":"sha512-Yv4cTLDDDQ50ncCWRkfNMPkbc9F9lh/ojCs6DwuA2ee4siBRu7FCqRPz28Qg47aMUMqwr+zPkLifpAf8JZ+zEw==","signatures":[{"sig":"MEQCIEss2pYJWX/F8dMvgm+xSQ3sAQNNy+2/IxJr9D1dkrUhAiANS8Qb5yOIY6h+nLYb6BfuHOJHzfCTUr/EIoBqFnZTUQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51598},"main":"lib/cjs/watcher.js","config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"module":"lib/esm/watcher.js","engines":{"node":">=20.19.0"},"gitHead":"b53982dd7962d999e45ff9fcd19452aca938f757","scripts":{"fmt":"eslint . --ext .js,.ts --fix","lint":"eslint . --ext .js,.ts","test":"jest","build":"run-s clean && run-p build:*","clean":"rimraf lib","prepare":"npm run build && husky","coverage":"jest --coverage","postpack":"run-s clean","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","prepublishOnly":"npm run lint","semantic-release":"semantic-release"},"typings":"lib/cjs/watcher.d.ts","_npmUser":{"name":"hsluoyz","email":"hsluoyz@gmail.com"},"licenses":[{"url":"http://www.apache.org/licenses/LICENSE-2.0","type":"Apache-2.0"}],"repository":{"url":"git+https://github.com/node-casbin/mongo-changestream-watcher.git","type":"git"},"_npmVersion":"10.9.4","description":"Casbin Watcher based on MongoDB Change Streams","directories":{"test":"test","example":"examples"},"_nodeVersion":"20.19.5","dependencies":{"mongodb":"^6.20.0"},"publishConfig":{"tag":"latest","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","husky":"^9.1.7","sinon":"^21.0.0","casbin":"^5.40.0","eslint":"^8.22.0","ts-jest":"^29.4.5","coveralls":"^3.1.1","typescript":"^5.9.3","@types/jest":"^30.0.0","npm-run-all":"^4.1.5","eslint-plugin-n":"^15.2.4","jsdoc-to-markdown":"^9.1.3","eslint-plugin-jest":"^26.8.7","eslint-plugin-node":"^11.1.0","eslint-plugin-import":"^2.26.0","eslint-plugin-promise":"^6.0.0","eslint-config-standard":"^17.0.0","casbin-mongoose-adapter":"^5.4.0","cz-conventional-changelog":"^3.3.0","@typescript-eslint/eslint-plugin":"^5.33.1","eslint-config-standard-with-typescript":"^22.0.0"},"peerDependencies":{"casbin":"^5.40.0"},"_npmOperationalInternal":{"tmp":"tmp/mongo-changestream-watcher_1.2.0_1762351618633_0.8897669954864178","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@casbin/mongo-changestream-watcher","version":"1.3.0","description":"Casbin Watcher based on MongoDB Change Streams","main":"lib/cjs/watcher.js","typings":"lib/cjs/watcher.d.ts","module":"lib/esm/watcher.js","homepage":"https://github.com/node-casbin/mongo-changestream-watcher","directories":{"example":"examples","test":"test"},"repository":{"type":"git","url":"git+https://github.com/node-casbin/mongo-changestream-watcher.git"},"bugs":{"url":"https://github.com/node-casbin/mongo-changestream-watcher/issues"},"publishConfig":{"tag":"latest","registry":"https://registry.npmjs.org"},"scripts":{"lint":"eslint . --ext .js,.ts","fmt":"eslint . --ext .js,.ts --fix","prepublishOnly":"npm run lint","test":"jest","semantic-release":"semantic-release","coverage":"jest --coverage","postpack":"run-s clean","build":"run-s clean && run-p build:*","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","clean":"rimraf lib","prepare":"npm run build && husky"},"keywords":["casbin","node-casbin","watcher","mongodb"],"author":{"name":"Node-Casbin"},"contributors":[{"name":"Joakim Järvinen","email":"Sefriol@users.noreply.github.com","url":"https://github.com/Sefriol"}],"licenses":[{"type":"Apache-2.0","url":"http://www.apache.org/licenses/LICENSE-2.0"}],"engines":{"node":">=20.19.0"},"devDependencies":{"@types/jest":"^30.0.0","@typescript-eslint/eslint-plugin":"^5.33.1","casbin":"^5.40.0","casbin-mongoose-adapter":"^5.4.0","coveralls":"^3.1.1","cz-conventional-changelog":"^3.3.0","eslint":"^8.22.0","eslint-config-standard":"^17.0.0","eslint-config-standard-with-typescript":"^22.0.0","eslint-plugin-import":"^2.26.0","eslint-plugin-jest":"^26.8.7","eslint-plugin-n":"^15.2.4","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^6.0.0","husky":"^9.1.7","jest":"^30.2.0","jsdoc-to-markdown":"^9.1.3","npm-run-all":"^4.1.5","sinon":"^21.0.0","ts-jest":"^29.4.5","typescript":"^5.9.3"},"dependencies":{"mongodb":"^6.20.0"},"peerDependencies":{"casbin":"^5.40.0"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"_id":"@casbin/mongo-changestream-watcher@1.3.0","gitHead":"9cf453a30606411636ccd3a2c4814c1f1a763b32","_nodeVersion":"20.19.5","_npmVersion":"10.9.4","dist":{"integrity":"sha512-LPGUBDSB7SDz0TM0uDOamk1cMU4rjzFfndee2v2xYfvKFt7dP21cO8wu1YpkPvO3/11agPTUYXlVDLkyneuvcQ==","shasum":"5c1085f2d271e156b5e266429b5a68596482096e","tarball":"https://registry.npmjs.org/@casbin/mongo-changestream-watcher/-/mongo-changestream-watcher-1.3.0.tgz","fileCount":33,"unpackedSize":51768,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDBav2uG2Rr6kak6BGsm7zsBOZXZi13gNpYpSsdgNuikQIgS1FmPQpK8oHvNGozmTo1nB6jsJkUgo5KK6xQLxHlGDk="}]},"_npmUser":{"name":"hsluoyz","email":"hsluoyz@gmail.com"},"maintainers":[{"name":"hsluoyz","email":"hsluoyz@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mongo-changestream-watcher_1.3.0_1762353082145_0.8196888042193171"},"_hasShrinkwrap":false}},"time":{"created":"2022-08-26T13:55:44.458Z","modified":"2025-11-05T14:31:22.590Z","1.0.0":"2022-08-26T13:55:44.830Z","1.1.0":"2023-05-13T03:33:57.213Z","1.1.1":"2023-08-07T01:48:53.794Z","1.2.0":"2025-11-05T14:06:58.842Z","1.3.0":"2025-11-05T14:31:22.341Z"},"bugs":{"url":"https://github.com/node-casbin/mongo-changestream-watcher/issues"},"author":{"name":"Node-Casbin"},"homepage":"https://github.com/node-casbin/mongo-changestream-watcher","keywords":["casbin","node-casbin","watcher","mongodb"],"repository":{"type":"git","url":"git+https://github.com/node-casbin/mongo-changestream-watcher.git"},"description":"Casbin Watcher based on MongoDB Change Streams","contributors":[{"name":"Joakim Järvinen","email":"Sefriol@users.noreply.github.com","url":"https://github.com/Sefriol"}],"maintainers":[{"name":"hsluoyz","email":"hsluoyz@gmail.com"}],"readme":"Node-Casbin Watcher based on MongoDB Change Streams\n====\n[![CI](https://github.com/node-casbin/mongo-changestream-watcher/actions/workflows/main.yml/badge.svg)](https://github.com/node-casbin/mongo-changestream-watcher/actions/workflows/main.yml)\n[![Coverage Status](https://coveralls.io/repos/github/node-casbin/mongo-changestream-watcher/badge.svg?branch=master)](https://coveralls.io/github/node-casbin/mongo-changestream-watcher?branch=master)\n[![NPM version][npm-image]][npm-url]\n[![NPM download][download-image]][download-url]\n[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2)](https://discord.gg/S5UjpzGZjN)\n\n[npm-image]: https://img.shields.io/npm/v/@casbin/mongo-changestream-watcher.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/@casbin/mongo-changestream-watcher\n[download-image]: https://img.shields.io/npm/dm/@casbin/mongo-changestream-watcher.svg?style=flat-square\n[download-url]: https://npmjs.org/package/@casbin/mongo-changestream-watcher\n\nFor more information about MongoDB Change Streams, look [here](https://www.mongodb.com/docs/manual/changeStreams/).\n\nMore information about Casbin Watchers, look [here](https://casbin.org/docs/watchers).\n\n## Installation\n\n```shell script\n# NPM\nnpm install --save @casbin/mongo-changestream-watcher\n\n# Yarn\nyarn add @casbin/mongo-changestream-watcher\n```\n\n## Simple Example using Mongoose Adapter\n\n```typescript\nimport { MongoChangeStreamWatcher } from '@casbin/mongo-changestream-watcher';\nimport { newEnforcer } from 'casbin';\n\n// Initialize the watcher by connecting to a replica set.\nconst watcher = await MongoChangeStreamWatcher.newWatcher('mongodb://localhost:27001,localhost:27002/casbin?replicaSet=rs0', {collectionName: 'casbin_rule'});\nconst adapter = await MongooseAdapter.newAdapter('mongodb://localhost:27001,localhost:27002/casbin?replicaSet=rs0');\nconst enforcer = await newEnforcer('test/fixtures/basic_model.conf', adapter);\n\n// Initialize the enforcer.\nconst enforcer = await newEnforcer('examples/authz_model.conf', 'examples/authz_policy.csv');\n\nenforcer.setWatcher(watcher);\n\n// By default, the watcher's callback is automatically set to the\n// enforcer's loadPolicy() in the setWatcher() call.\n// We can change it by explicitly setting a callback.\nwatcher.setUpdateCallback(() => console.log('Casbin need update'));\n```\n\n## Notes\n\nThis watcher does not operate with `update`-calls typically found in other watchers. Mongo Change Stream directly reacts to changes in the database collection, and therefore all other watchers listening to the same stream will be automatically notified when changes do occur. However, this means that watcher also gets notified by its own changes.\n","readmeFilename":"README.md"}