cost 85 ms
如何使用文件中的验证模式验证 MongoDB 文档? - How can I validate a MongoDB document using a validation schema from a file?

我想在将文档插入数据库之前对其进行验证。 我知道我可以设置 static 验证器,但我更希望有一个包含我可以随时修改的验证模式的文件。 然后我会做类似validate(document, userCreateValidationSchema)事情。 感谢您的任何想法。 我曾尝试在文档中寻找答案,但 ...

当前Next.js 13.3版本如何连接Mongodb和mongoose? - How to connect Mongodb with mongoose in current Next.js 13.3 Version?

我试图在 Next.js 13.3 版本的 mongoose 的帮助下连接 mongodb,但是当我在 api/getProducts/route.js 文件中导入 connectDb 文件或 UserSchema 文件时,它给出了不同的错误。 请帮助并逐步告诉我如何连接我被卡住了! 首先,我在名 ...

服务器无法正常启动。 错误类型错误:无法读取未定义的属性(读取“寄存器”) - Server wasn't able to start properly. error TypeError: Cannot read properties of undefined (reading 'register')

我正在尝试将带有 MongoDB 的 Strapi v3 迁移到带有 Postgres 的 Strapi v4。 我正在关注官方文档https://docs.strapi.io/dev-docs/migration/v3-to-v4/data/mongo并安装了以下依赖项: npm 安装 str ...

Node / express / mongodb docker-compose 文件由于 shell 文件中的“shift 2”而失败 - Node / express / mongodb docker-compose file fails because of "shift 2" in shell file

我正在尝试构建此应用程序https://github.com/dwgebler/node-express-example 。 我想用它作为制作 Mongodb http 快递服务器的模板。 我试图在此 repo 中构建 docker 撰写文件,如下所示: 但是当我在与 docker-compose. ...

如何在单次调用中使用官方 c# 驱动程序使用 MongoDB 根据条件更新不同的字段? - How to update different field based on condition using MongoDB using official c# driver in single call?

我有两个名为List<Guid> A和List<Guid>B的 ID 列表, 对于list A我想设置Update.Set("IsPending", True)和对于List B ,我想设置Update.Set("IsComplete", True) 。 我可以通过两个数据 ...

MongoDB findOneAndDelete() 不会删除指定的查询——我不太明白为什么? - MongoDB findOneAndDelete() will not delete the specified query-- I can't quite figure out why?

我正在尝试编写一个 Discord.JS 机器人,它使用 MongoDB 的 Model 和架构功能列出和删除特定的频道/线程。 我已经弄清楚了其他所有内容,实际的消息删除、频道删除以及删除 function 所需的所有其他内容,但出于某种原因提示 MongoDB 使用指定的 ID 删除 Chat ...

在 MongoDB 节点 JS Rest API 中使用 ObjectId class 时出现类型错误 - Type Error when using ObjectId class in MongoDB Node JS Rest API

我正在使用 Next Js 和 MongoDB 创建 rest API,并使用 Type Script 检查。 创建通过 Id 获取帖子的路由之一时,出现以下错误: 这是我的 API 代码: 我还尝试在从 _req.query 解构 postId 时传递默认值,如下所示: 但是,错误仍然存在。 错误 ...

使用 Kotlin Springboot 中的条件将 Mongo DB 中的 DateTime 字段与给定日期进行比较 - Compare DateTime field in Mongo DB with given Date using Criteria in Kotlin Springboot

我有一个要求,我需要使用提供的 referenceDate 过滤 mongo db 中的记录。 dateTimeValidUntil 在数据库中存储为 LocalDateTime。 数据库中的数据: 我的查询: 但它不会过滤掉在前一个日期结束的记录,例如当 refDate = 2023-01-01 ...

如何将数据从一种结构迁移到另一种结构? - How do I migrate my data from one structure to another?

我有一个 MongoDB 和 3 个 collections。这是 3 个 collections,每个都有一个它包含的文档示例: tag computer setting 如您所见,所有 3 个文档都有一个category属性,最后两个文档有一个tags属性。 这个想法是您可以创建一个标签并使用 ...

如果使用 mongodb 聚合管道在时间段内不存在,则用 NULL 值填充数据 - Fill data with NULL value if it is not present in the timeperiod using mongodb aggregation pipeline

我必须编写一个聚合管道,我将在其中传递: 一天的开始日期和结束数据的时间戳我必须将数据分成 30 分钟的桶,并在这些桶之间查找数据,例如: 2023-01-16T00:30:00.000+00:00、2023-01-16T01:00:00.000+00:00、2023-01-16T01:30:00 ...


 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM