[SERVER-82274] singleBatch find on a timeseries collection does not close cursor if batchSize is set Created: 17/Oct/23  Updated: 15/Nov/23  Resolved: 15/Nov/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 7.0.2
Fix Version/s: 7.3.0-rc0

Type: Bug Priority: Major - P3
Reporter: Neal Beeken Assignee: Will Buerger
Resolution: Fixed Votes: 0
Labels: time-series
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by COMPASS-7462 Investigate changes in SERVER-82274: ... Closed
Documented
is documented by DOCS-16499 Investigate changes in SERVER-82274: ... Backlog
Related
related to SERVER-80713 ID on exhausted cursor no longer 0 Closed
related to NODE-5691 findOne on a timeseries collection le... Closed
related to SERVER-83077 Check one getNext beyond batchSize fo... Closed
Assigned Teams:
Query Integration
Backwards Compatibility: Minor Change
Operating System: ALL
Steps To Reproduce:

// Setup TimeSeries collection
test> db.createCollection('ts', {timeseries: {timeField: 'd'}})
{ ok: 1 }
test> db.ts.insertOne({d: new Date()})
{ insertedId: ObjectId("652ee0db06dac1dd0b800a19") }
 
// batchSize
test> db.runCommand({ find: 'ts', filter: {}, singleBatch: true, batchSize: 1, limit: 1 })
{
  cursor: {
    firstBatch: [{ ... }],
    id: Long("9141572560536167994"), // non-zero
    ns: 'test.ts'
  },
  ok: 1,
}
 
// no batchSize
test> db.runCommand({ find: 'ts', filter: {}, singleBatch: true, limit: 1 })
{
  cursor: {
    firstBatch: [{ ... }],
    id: Long("0"), // zero
    ns: 'test.ts'
  },
  ok: 1,
}

Sprint: QI 2023-11-27
Participants:

 Description   

When using a TimeSeries collection if a find command has batchSize:1 and singleBatch:true the cursor returned is not closed, it reports a non-zero id. If the batchSize is omitted then the cursor will be closed. The same behavior is not observed for a typical collection, the id returned is always zero when singleBatch is set.



 Comments   
Comment by Githook User [ 15/Nov/23 ]

Author:

{'name': 'Will Buerger', 'email': 'will.buerger@mongodb.com', 'username': 'wbuerger46'}

Message: SERVER-82274: Find command on a view returns no cursor when given singleBatch: true with batchSize is 1
Branch: master
https://github.com/mongodb/mongo/commit/c11fffdfef27c0e256fd9df5e5a17aff6adb1330

Generated at Thu Feb 08 06:48:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.