1、连接数据库,需要指定数据库名称,如果指定的数据库不存在,mongo会自动创建数据库。 2、首先,使用com.mongodb.client.MongoDatabase类的 getCollection() 方法来获取一个集合。 3、然后使用com.mongodb.client.MongoCollec Read More
posted @ 2021-01-28 10:26 冰可乐不是雪碧 Views(911) Comments(0) Diggs(0) Edit
1、增加:MongoDB 使用 insert() 或 save() 方法向集合中插入文档语法如下:db.COLLECTION_NAME.insert(document) 2、删除:remove() 方法基本语法:db.collection.remove( <query>, <justOne>) 如果 Read More
posted @ 2021-01-28 10:23 冰可乐不是雪碧 Views(89) Comments(0) Diggs(0) Edit