خرید بک لینک

Vote count: 0

I have thousands of items in my gameItem collection with the following as example.

{
    "weapon name 1":{price:01},
    "weapon name 2":{price:100}
}

and I run a query like so in shell

db.gameItems.find({"weapon name 1":{$exists:1}})

nothing retus but it works when my keys don't have spaces...

First questions: Is there a way to search key values with spaces? Second question: Should I change my data model to be like so?:

   {
      weapon:{name: "weapon name 1", price:01}
      weapon:{name: "weapon name 2", price:100}
   }

And then add an index to the weapon name field? Does this increase search performance with only 2 fields in each weapon document?

Thanks

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 6 خرداد 1395 ساعت: 3:39

صفحه بندی