-2

here is an example structure of one object in my MongoDB:

{    
 "itemClass": 4,
 "containerSlots": 0,
 "itemBind": 1,
 "weaponInfo": {
   "dps": "0.0",
   "damage": {
     "maxDamage": 0,
     "minDamage": 0
   },
   "weaponSpeed": "0.5"
 }
}

I need to find maxDamage which is 1

here is my query:

db.items.find({"maxDamage" : "1"}).limit(3)

but it returns nothing

p.s. there are a lot of objects with attribute maxDamage is 1

Cœur
  • 34,719
  • 24
  • 185
  • 251
user3917453
  • 105
  • 1
  • 7

1 Answers1

0

You have to use dot notation like this:

db.items.find({"weaponInfo.damage.maxDamage": 1})
zero323
  • 305,283
  • 89
  • 921
  • 912