将mongodb插入我的json文件

时间:2015-10-31 14:12:27

标签: json mongodb

"Title": "Anti-Mage",
    "Url": "antimage",
    "ID": 1,
    "Lore": "The monks of Turstarkuri watched the rugged valleys below their mountain monastery as wave after wave of invaders swept through the lower kingdoms. Ascetic and pragmatic, in their remote monastic eyrie they remained aloof from mundane strife, wrapped in meditation that knew no gods or elements of magic. Then came the Legion of the Dead God, crusaders with a sinister mandate to replace all local worship with their Unliving Lord's poisonous nihilosophy. From a landscape that had known nothing but blood and battle for a thousand years, they tore the souls and bones of countless fallen legions and pitched them against Turstarkuri. The monastery stood scarcely a fortnight against the assault, and the few monks who bothered to surface from their meditations believed the invaders were but demonic visions sent to distract them from meditation. They died where they sat on their silken cushions. Only one youth survived - a pilgrim who had come as an acolyte, seeking wisdom, but had yet to be admitted to the monastery. He watched in horror as the monks to whom he had served tea and nettles were first slaughtered, then raised to join the ranks of the Dead God's priesthood. With nothing but a few of Turstarkuri's prized dogmatic scrolls, he crept away to the comparative safety of other lands, swearing to obliterate not only the Dead God's magic users - but to put an end to magic altogether. ",
    "SuggestedRoleLevels": {
      "Carry": 2,
      "Escape": 3
    },
    "Enabled": true,
    "Side": "Radiant",
    "Aliases": [
      "am"
    ],
    "AttackCapabilities": "DOTA_UNIT_CAP_MELEE_ATTACK",
    "PrimaryAttribute": "DOTA_ATTRIBUTE_AGILITY",
    "Initial": {
      "Strength": 22,
      "StrengthGain": 1.2,
      "Agility": 22,
      "AgilityGain": 2.8,
      "Intelligence": 15,
      "IntelligenceGain": 1.8,
      "Health": 568,
      "HealthRegen": 0.91,
      "Mana": 195,
      "ManaRegen": 0.61,
      "Armor": 2.08,
      "MagicResistance": 0.25,
      "MinDamage": 49,
      "MaxDamage": 53,
      "AvgDamage": 51,
      "IncreasedAttackSpeed": 22,
      "BaseAttackTime": 1.45,
      "AttackTime": 1.19,
      "AttacksPerSecond": 0.84,
      "AttackAnimationPoint": 0.3,
      "AttackAcquisitionRange": 600,
      "AttackRange": 128,
      "VisionDayRange": 1800,
      "VisionNightRange": 800,
      "ProjectileSpeed": 0,
      "MovementSpeed": 315,
      "TurnRate": 0.5
    },
    "Abilities": [
      {
        "Title": "Mana Break",
        "Url": "mana_break",
        "HeroAbilityUrl": "antimage_mana_break",
        "ID": 5003,
        "Description": "Burns an opponent's mana on each attack. Mana Break deals 60% of the mana burned as damage to the target. Mana Break is a Unique Attack Modifier, and does not stack with other Unique Attack Modifiers.",
        "Lore": "A modified technique of the Turstarkuri monks' peaceful ways is to turn magical energies on their owner.",
        "Notes": [
          "Mana Burn is blocked by spell immunity.",
          "You can lifeleech the damage dealt by this skill with a Lifesteal aura."
        ],
        "Type": "DOTA_ABILITY_TYPE_BASIC",
        "Behavior": [
          "DOTA_ABILITY_BEHAVIOR_PASSIVE"
        ],
        "DamageType": "DAMAGE_TYPE_PHYSICAL",
        "AbilitySpecial": [
          {
            "Name": "Damage Per_burn",
            "Url": "damage_per_burn",
            "Value": [
              0.6
            ]
          },
          {
            "Name": "Mana Burned Per Hit",
            "Url": "mana_per_hit",
            "ValueType": "FIXED",
            "Value": [
              28,
              40,
              52,
              64
            ]
          }
        ]

这是我的json文件中的一个片段,我想将它插入名为dota2的mongodb中。

我正在尝试命令:

mongoimport --jsonArray -d dota2 -c docs --file heroes.json
回复告诉我:

2015-10-31T12:09:35.755-0200    connected to: localhost
2015-10-31T12:09:35.842-0200    imported 110 documents

但是我没有获得我的数据信息,命令:db.dota.find() 返回空......

有人可以帮帮我吗?是的...我是mongodb的新手。 :/

2 个答案:

答案 0 :(得分:1)

根据您的命令,您将数据插入到数据库dota2中的名为docs的集合中。

所以你应该这样做

use dota2;
db.docs.find();

答案 1 :(得分:0)

好的,我明白了,我的数据都在mongodb里面!但内部文档集:)它的工作原理!