時(shí)間:2024-02-04 13:45作者:下載吧人氣:22
文檔的數(shù)據(jù)結(jié)構(gòu)和 JSON 基本一樣。
所有存儲(chǔ)在集合中的數(shù)據(jù)都是 BSON 格式。BSON 是一種類似 JSON 的二進(jìn)制形式的存儲(chǔ)格式,是 Binary JSON 的簡(jiǎn)稱。
1、db.collection.insert(): 向集合中插入文檔,若插入的數(shù)據(jù)主鍵已經(jīng)存在,則會(huì)拋 org.springframework.dao.DuplicateKeyException 異常,提示主鍵重復(fù),不保存當(dāng)前數(shù)據(jù)。
db.collection.insert(document)
網(wǎng)友評(píng)論