⬆️ update mongodb
This commit is contained in:
parent
731ea2e751
commit
e683073549
@ -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
BIN
package-lock.json
generated
Binary file not shown.
@ -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": {
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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 */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user