我面临与从MongoDB集合中获取数据有关的问题。我在MongoDB数据库中有以下集合:
{ item: "journal", qty: 25, tags: ["blank", "red"], dim_cm: [ 14, 21 ] },
{ item: "planner", qty: 75, tags: ["blank", "red"], dim_cm: [ 22.85, 30 ] },
{ item: "postcard", qty: 45, tags: ["blue"], dim_cm: [ 10, 15.25 ] }
])```
I have a below query:
```db.inventory.find( { dim_cm: { $gt: 25 } } )```
Result: ```***{ item: "planner", qty: 75, tags: ["blank", "red"], dim_cm: [ 22.85, 30 ] }***```
However, I want the result should be:
```{ item: "planner", qty: 75, tags: ["blank", "red"], dim_cm: [ 30 ] }```
Is it possible to get mentioned result. I have tried different ways but unfortunately I am unable to find any solution towards it.
将查询更改为此用途$gte
db.inventory.find( { dim_cm: { $gte: 25 } } )