⬆️ update mongodb

This commit is contained in:
Flam3rboy 2021-04-06 23:25:11 +02:00
parent 731ea2e751
commit e683073549
5 changed files with 13 additions and 4 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/"
```

BIN
package-lock.json generated

Binary file not shown.

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 */