hhyo / hhyo/Archery

Mongo 使用投影查询,返回的结果为N/A

Open
#2,172 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7k
Forks
1.9k
Avg merge
2d 11h
Merged PRs (30d)
6

Description

### 重现步骤

db.RIC_IqyMediaId.find({})
.projection({})
.sort({_id:-1})
.limit(100)

使用该语法进行查询,除了ID其他列返回值为N/A

### 预期外的结果

![image](https://github.com/hhyo/Archery/assets/25998534/b1c68506-bf9c-4538-b740-cecd360a4b02)

### 日志文本

_No response_

### 版本

1.9.1

### 部署方式

K8S

### 是否还有其他可以辅助定位问题的信息?比如数据库版本等

将查询语句改为
db.RIC_IqyMediaId.find({})
.projection()
.sort({_id:-1})
.limit(100)后,
能够返回正常结果

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Reproduce the MongoDB query from issue 2172 on Archery 1.9.1, comparing projection({}) with projection(), then trace the query and result handling until the non-ID fields become N/A. Done means an empty projection returns the document fields normally, with a regression check for the reported syntax.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.