fix: updateById error

This commit is contained in:
MiaoWoo 2019-06-13 18:58:56 +08:00
parent eef5226ac3
commit 034a43b2e8
7 changed files with 97 additions and 2 deletions

View File

@ -0,0 +1,22 @@
src
test
typings
bundled
build
coverage
docs
wiki
gulpfile.js
bower.json
karma.conf.js
tsconfig.json
typings.json
CONTRIBUTING.md
ISSUE_TEMPLATE.md
PULL_REQUEST_TEMPLATE.md
tslint.json
wallaby.js
.travis.yml
.gitignore
.vscode
type_definitions

View File

@ -20,6 +20,7 @@
"cc-server-ioc": "^0.2.2",
"inversify": "^5.0.1",
"inversify-express-utils": "^6.3.2",
"prettyjson": "^1.2.1",
"reflect-metadata": "^0.1.13",
"typescript": "^3.5.1"
},

View File

@ -1,7 +1,8 @@
import 'reflect-metadata';
import { InversifyExpressServer } from 'inversify-express-utils';
import { InversifyExpressServer, getRouteInfo } from 'inversify-express-utils';
import * as bodyParser from 'body-parser';
import { container, buildProviderModule } from 'cc-server-ioc';
import * as prettyjson from "prettyjson";
import './function/handle';
@ -19,6 +20,11 @@ server.setConfig((app) => {
});
let serverInstance = server.build();
const routeInfo = getRouteInfo(container);
console.log(prettyjson.render({ routes: routeInfo }));
serverInstance.listen(80);
console.log('Server started on port 80 :)');

View File

@ -0,0 +1,22 @@
src
test
typings
bundled
build
coverage
docs
wiki
gulpfile.js
bower.json
karma.conf.js
tsconfig.json
typings.json
CONTRIBUTING.md
ISSUE_TEMPLATE.md
PULL_REQUEST_TEMPLATE.md
tslint.json
wallaby.js
.travis.yml
.gitignore
.vscode
type_definitions

View File

@ -53,7 +53,7 @@ export class MongoDBClient<T = any> implements DBClient {
}
public async updateById(objectId: string, model: any): Promise<boolean> {
return await this.updateOne({ _id: new ObjectID(objectId) }, { $set: model })
return await this.updateOne({ _id: new ObjectID(objectId) }, model)
}
public async deleteOne(where: any): Promise<boolean> {

View File

@ -0,0 +1,22 @@
src
test
typings
bundled
build
coverage
docs
wiki
gulpfile.js
bower.json
karma.conf.js
tsconfig.json
typings.json
CONTRIBUTING.md
ISSUE_TEMPLATE.md
PULL_REQUEST_TEMPLATE.md
tslint.json
wallaby.js
.travis.yml
.gitignore
.vscode
type_definitions

View File

@ -0,0 +1,22 @@
src
test
typings
bundled
build
coverage
docs
wiki
gulpfile.js
bower.json
karma.conf.js
tsconfig.json
typings.json
CONTRIBUTING.md
ISSUE_TEMPLATE.md
PULL_REQUEST_TEMPLATE.md
tslint.json
wallaby.js
.travis.yml
.gitignore
.vscode
type_definitions