Skip to main content

Module update

Module update 

Source
Expand description

本地磁盘数据源 —— 写算子求值(insertOne / insertMany / updateMany / findOneAndUpdate / deleteMany)。

语义基准 = MongoDB 驱动语义(local 与 mongo 走同一条命令路径,必须同结果)。 纯逻辑:无 IO / 无时钟 / 无随机 —— 一切不确定性输入(_id、时间戳)均由 core / 宿主在命令中给足(core 不生成 _id)。

更新算子仅支持 $set / $inc / $unset(+ upsert 分支的 $setOnInsert, 对齐 dialect/write/update.rs 第 35–47 行);其余操作符($push / $addToSet / $pull …)一律 Err(禁静默丢弃)。

Functions§

delete_many
deleteMany:删除命中项;返回 {"deletedCount": n}。
find_one_and_update
findOneAndUpdate:首条命中应用更新;
insert_many
insertMany:upsertById == true → 按 _id replace(归档幂等,对齐 mongo.js 第 136–143 行);否则同 _id 冲突(含批内重复)→ Err。
insert_one
insertOne:追加 cmd.doc;同 _id 冲突 → Err(对齐 Mongo 唯一键冲突)。
update_many
updateMany:过滤命中项全部应用 cmd.update;返回 {"modifiedCount": n}。