diff --git a/examples/mongodb-crud/backend/src/api/ApiAddPost.ts b/examples/mongodb-crud/backend/src/api/ApiAddPost.ts index 924a185..3491e1a 100644 --- a/examples/mongodb-crud/backend/src/api/ApiAddPost.ts +++ b/examples/mongodb-crud/backend/src/api/ApiAddPost.ts @@ -3,14 +3,6 @@ import { Global } from "../models/Global"; import { ReqAddPost, ResAddPost } from "../shared/protocols/PtlAddPost"; export async function ApiAddPost(call: ApiCall) { - console.log('cccgasdgasd', call.service.conf) - if (call.service.conf) { - // if (没登录) { - // call.error('你还没登录'); - // return; - // } - } - let op = await Global.collection('Post').insertOne({ ...call.req.newPost, create: { diff --git a/examples/mongodb-crud/backend/src/api/ApiUpdatePost.ts b/examples/mongodb-crud/backend/src/api/ApiUpdatePost.ts index 24c8605..4cddbaa 100644 --- a/examples/mongodb-crud/backend/src/api/ApiUpdatePost.ts +++ b/examples/mongodb-crud/backend/src/api/ApiUpdatePost.ts @@ -9,13 +9,15 @@ export async function ApiUpdatePost(call: ApiCall) let op = await Global.collection('Post').updateOne({ _id: new ObjectID(_id) }, { - $set: update + $set: { + ...update, + update: { + uid: 'xxx', + time: new Date() + } + } }); - console.log('ssss', { - matchedCount: op.matchedCount - }) - call.succ({ matchedCount: op.matchedCount })