mongodb crud

This commit is contained in:
k8w 2022-02-26 11:32:37 +08:00
parent 3e87af42e1
commit 3ae8b81da4

View File

@ -4,13 +4,13 @@ import { Global } from "../models/Global";
import { ReqUpdatePost, ResUpdatePost } from "../shared/protocols/PtlUpdatePost";
export async function ApiUpdatePost(call: ApiCall<ReqUpdatePost, ResUpdatePost>) {
let { _id, ...update } = call.req.update;
let { _id, ...rest } = call.req.update;
let op = await Global.collection('Post').updateOne({
_id: _id
}, {
$set: {
...update,
...rest,
update: {
uid: 'xxx',
time: new Date()