在MongoDB中创建集合时出错

时间:2013-04-29 18:35:22

标签: mongodb

我是MongoDB的新手。我无法创建一个集合。它在mongo shell中给出一个句子 - Display all 169 possibilities? (y or n)。代码是 -

db.Lead.insert( 
{ LeadID: 1, 
  MasterAccountID: 100, 
  LeadName: 'Sarah', 
  LeadEmailID : 'sarah@hmail.com', 
  LeadPhoneNumber : '2132155445', 
  Details : [{ StateID: 1, 
              TaskID : 1, 
              Assigned By : 1001, 
              TimeStamp : '10:00:00', 
              StatusID : 1 }
            ]
} 
)

不确定是什么问题。请帮我解决一下。

问候。

1 个答案:

答案 0 :(得分:0)

Assigned By中有空格外,一切看起来都不错。

我可以正确插入。

> db.Lead.find().pretty()
{
        "_id" : ObjectId("517ebe75278e0557fd167eb7"),
        "LeadID" : 1,
        "MasterAccountID" : 100,
        "LeadName" : "Sarah",
        "LeadEmailID" : "sarah@hmail.com",
        "LeadPhoneNumber" : "2132155445",
        "Details" : [
                {
                        "StateID" : 1,
                        "TaskID" : 1,
                        "AssignedBy" : 1001,
                        "TimeStamp" : "10:00:00",
                        "StatusID" : 1
                }
        ]
}
相关问题