在MongoDB中创建集合时出错 [英] Errors while creating a collection in MongoDB

查看:165
本文介绍了在MongoDB中创建集合时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am new to MongoDB. I am not able to create a collection. It gives a sentence in the mongo shell - Display all 169 possibilities? (y or n). The code is -

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 }
            ]
} 
)

不确定是什么问题.请同样帮我.

Not sure what the issue is. Please help me out with the same.

致谢.

推荐答案

除了Assigned By中有一个空格外,其他所有内容看起来都很不错.

Apart from the fact there is a space in Assigned By everything looks good.

我能够正确插入它.

> 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
                }
        ]
}

这篇关于在MongoDB中创建集合时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆