本文介绍了在MongoDB查询中,负数限制是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Mongoid红宝石与MongoDB进行交互,当我尝试从查询中获取某项内容时,当我希望它仅使用1
时,它会添加$limit: -1
(即负数). .我尝试在控制台中执行相同的操作,但它没有更改返回的文档.
I'm using the Mongoid ruby gem to interact w/ MongoDB and when I try to get one of something from a query, it adds $limit: -1
(i.e. negative one) when I would expect it to just use 1
. I tried doing the same thing in the console and it didn't change which document was returned.
负限制意味着特殊吗?
推荐答案
在"Mongo Wire Protocol"文档的"OP_QUERY"部分.
有关游标和限制的更多信息,请参见查询和游标"文档,特别是现在已删除的批量执行查询" 部分.
For more information on cursors and limit, please see the "Queries and Cursors" documentation, specifically the now-removed "Execution of queries in batches" section.
这篇关于在MongoDB查询中,负数限制是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!