如何保存MongoDB文档?

如何保存MongoDB文档?,mongodb,document-database,Mongodb,Document Database,假设我想在MongoDB中保存以下JSON文档: { "_id": 1, "first_name" : "John", "last_name" : "Walker", "address" : { "street": "22 Rue du Grenier Saint-Lazare", "postal

假设我想在MongoDB中保存以下JSON文档:

{
  "_id": 1,
  "first_name" : "John",
  "last_name" : "Walker",
  "address" : {
    "street": "22 Rue du Grenier Saint-Lazare",
    "postal_code": "75003",
    "city": "Paris"
  }
}
它实际上是如何保存在MongoDB中的

它有索引机制吗

我想知道mongo是否只保存根文档(即{key=1-->value=BSON of the thill document})

或者保存根目录并保存其他字段和子元素(即{key=1-->value=BSON of thigh document}++{key=1_first_name-->value=BSON of“John”}++{key=1_address-->value=BSON of thigh address}+{key=1_address_street-->value=BSON…)

如果您想了解详细信息,请访问