⬆️ update mongodb

This commit is contained in:
Flam3rboy 2021-04-06 23:25:11 +02:00
parent 731ea2e751
commit e683073549
5 changed files with 89 additions and 13 deletions

View File

@ -1 +1,9 @@
# server-util # server-util
add to package.json:
```json
"start": "npm run build:util && npm run build && node dist/",
"build": "tsc -b .",
"build:util": "tsc -b ./node_modules/fosscord-server-util/"
```

85
package-lock.json generated
View File

@ -12,7 +12,7 @@
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"lambert-db": "^1.1.7", "lambert-db": "^1.1.7",
"missing-native-js-functions": "^1.2.2", "missing-native-js-functions": "^1.2.2",
"mongodb": "^3.6.4", "mongodb": "^3.6.6",
"mongoose": "^5.12.3" "mongoose": "^5.12.3"
}, },
"devDependencies": { "devDependencies": {
@ -563,14 +563,14 @@
} }
}, },
"node_modules/mongodb": { "node_modules/mongodb": {
"version": "3.6.5", "version": "3.6.6",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.5.tgz", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz",
"integrity": "sha512-mQlYKw1iGbvJJejcPuyTaytq0xxlYbIoVDm2FODR+OHxyEiMR021vc32bTvamgBjCswsD54XIRwhg3yBaWqJjg==", "integrity": "sha512-WlirMiuV1UPbej5JeCMqE93JRfZ/ZzqE7nJTwP85XzjAF4rRSeq2bGCb1cjfoHLOF06+HxADaPGqT0g3SbVT1w==",
"dependencies": { "dependencies": {
"bl": "^2.2.1", "bl": "^2.2.1",
"bson": "^1.1.4", "bson": "^1.1.4",
"denque": "^1.4.1", "denque": "^1.4.1",
"require_optional": "^1.0.1", "optional-require": "^1.0.2",
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"saslprep": "^1.0.0" "saslprep": "^1.0.0"
}, },
@ -708,6 +708,45 @@
"mongoose": "*" "mongoose": "*"
} }
}, },
"node_modules/mongoose/node_modules/mongodb": {
"version": "3.6.5",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.5.tgz",
"integrity": "sha512-mQlYKw1iGbvJJejcPuyTaytq0xxlYbIoVDm2FODR+OHxyEiMR021vc32bTvamgBjCswsD54XIRwhg3yBaWqJjg==",
"dependencies": {
"bl": "^2.2.1",
"bson": "^1.1.4",
"denque": "^1.4.1",
"require_optional": "^1.0.1",
"safe-buffer": "^5.1.2",
"saslprep": "^1.0.0"
},
"engines": {
"node": ">=4"
},
"optionalDependencies": {
"saslprep": "^1.0.0"
},
"peerDependenciesMeta": {
"aws4": {
"optional": true
},
"bson-ext": {
"optional": true
},
"kerberos": {
"optional": true
},
"mongodb-client-encryption": {
"optional": true
},
"mongodb-extjson": {
"optional": true
},
"snappy": {
"optional": true
}
}
},
"node_modules/mpath": { "node_modules/mpath": {
"version": "0.8.3", "version": "0.8.3",
"resolved": "https://registry.npmjs.org/mpath/-/mpath-0.8.3.tgz", "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.8.3.tgz",
@ -762,6 +801,14 @@
"wrappy": "1" "wrappy": "1"
} }
}, },
"node_modules/optional-require": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.2.tgz",
"integrity": "sha512-HZubVd6IfHsbnpdNF/ICaSAzBUEW1TievpkjY3tB4Jnk8L7+pJ3conPzUt3Mn/6OZx9uzTDOHYPGA8/AxYHBOg==",
"engines": {
"node": ">=4"
}
},
"node_modules/p-limit": { "node_modules/p-limit": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
@ -1506,14 +1553,14 @@
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
}, },
"mongodb": { "mongodb": {
"version": "3.6.5", "version": "3.6.6",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.5.tgz", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz",
"integrity": "sha512-mQlYKw1iGbvJJejcPuyTaytq0xxlYbIoVDm2FODR+OHxyEiMR021vc32bTvamgBjCswsD54XIRwhg3yBaWqJjg==", "integrity": "sha512-WlirMiuV1UPbej5JeCMqE93JRfZ/ZzqE7nJTwP85XzjAF4rRSeq2bGCb1cjfoHLOF06+HxADaPGqT0g3SbVT1w==",
"requires": { "requires": {
"bl": "^2.2.1", "bl": "^2.2.1",
"bson": "^1.1.4", "bson": "^1.1.4",
"denque": "^1.4.1", "denque": "^1.4.1",
"require_optional": "^1.0.1", "optional-require": "^1.0.2",
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"saslprep": "^1.0.0" "saslprep": "^1.0.0"
} }
@ -1591,6 +1638,21 @@
"safe-buffer": "5.2.1", "safe-buffer": "5.2.1",
"sift": "7.0.1", "sift": "7.0.1",
"sliced": "1.0.1" "sliced": "1.0.1"
},
"dependencies": {
"mongodb": {
"version": "3.6.5",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.5.tgz",
"integrity": "sha512-mQlYKw1iGbvJJejcPuyTaytq0xxlYbIoVDm2FODR+OHxyEiMR021vc32bTvamgBjCswsD54XIRwhg3yBaWqJjg==",
"requires": {
"bl": "^2.2.1",
"bson": "^1.1.4",
"denque": "^1.4.1",
"require_optional": "^1.0.1",
"safe-buffer": "^5.1.2",
"saslprep": "^1.0.0"
}
}
} }
}, },
"mongoose-legacy-pluralize": { "mongoose-legacy-pluralize": {
@ -1649,6 +1711,11 @@
"wrappy": "1" "wrappy": "1"
} }
}, },
"optional-require": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.2.tgz",
"integrity": "sha512-HZubVd6IfHsbnpdNF/ICaSAzBUEW1TievpkjY3tB4Jnk8L7+pJ3conPzUt3Mn/6OZx9uzTDOHYPGA8/AxYHBOg=="
},
"p-limit": { "p-limit": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",

View File

@ -23,7 +23,7 @@
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"lambert-db": "^1.1.7", "lambert-db": "^1.1.7",
"missing-native-js-functions": "^1.2.2", "missing-native-js-functions": "^1.2.2",
"mongodb": "^3.6.4", "mongodb": "^3.6.6",
"mongoose": "^5.12.3" "mongoose": "^5.12.3"
}, },
"devDependencies": { "devDependencies": {

View File

@ -6,7 +6,7 @@ const uri = process.env.MONGO_URL || "mongodb://localhost:27017/fosscord?readPre
console.log(`[DB] connect: ${uri}`); console.log(`[DB] connect: ${uri}`);
const connection = mongoose.createConnection(uri, { autoIndex: true , useNewUrlParser: true, useUnifiedTopology: true }); const connection = mongoose.createConnection(uri, { autoIndex: true, useNewUrlParser: true, useUnifiedTopology: true });
export default <Connection>connection; export default <Connection>connection;
@ -32,6 +32,7 @@ export class MongooseCache extends EventEmitter {
} }
init = async () => { init = async () => {
// @ts-ignore
this.stream = this.collection.watch(this.pipeline, { fullDocument: "updateLookup" }); this.stream = this.collection.watch(this.pipeline, { fullDocument: "updateLookup" });
this.stream.on("change", this.change); this.stream.on("change", this.change);

View File

@ -1,5 +1,5 @@
{ {
"include": ["src"], "include": ["src/**/*.ts"],
"compilerOptions": { "compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */ /* Visit https://aka.ms/tsconfig.json to read more about this file */