Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如何限制查询(服务器端。我的知识是 Meteor)。例如,特定帖子的评论,而不是检索数据库中的所有评论。
我希望它限制在服务器端,以避免恶意客户端获取数据库的所有数据。
谢谢。
你可以使用限制。例如:post.comments.limit(10)
我想我们在 gitter 中讨论过这个问题,但我计划添加一个 query_restrictions api,您可以在其中拒绝您不喜欢的查询。我可能还会添加一个默认的全局可配置限制。(您可以在每个模型的基础上覆盖)