Currently, can not put "insertOne" due to maybe current jar. *I am using "mongo-java-driver-3.12.2.jar" on IntelliJ.
Would you mind telling me what jar file does include "insertOne" ?
What I'm trying to do is below.
MongoClientURI uri = new MongoClientURI(
"mongodb+srv://xxxx");
try(MongoClient mongoClient = new MongoClient(uri)){
MongoDatabase database = mongoClient.getDatabase("test");
MongoCollection<Document> collection = database.getCollection("test");
Document query = new Document("_id", new ObjectId("objectID xxxx"));
Document result = collection.find(query).iterator().next();
Document test = new Document("_id","ObjectID xxxx");
test.append("test4","test is 4");
query.insertOne(test); --> Currently the "insertOne" is not recognized..
System.out.println("Test3: "+result.getString("test3"));
insertOneon aDocumentobject. That doesn't make sense. You insert on aMongoCollection. See the guide here: mongodb.github.io/mongo-java-driver/3.4/driver/getting-started/…