I'm new to mongo, I'm trying to make an insert in the bank but it's the problem at the time of inserting
import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.MongoClient;
public class InsertDriver {
public static void main(String[] args) throws UnknownHostException {
DB dB = (new MongoClient("localhost", 27017)).getDB("realdatabase");
DBCollection dBCollection = dB.getCollection("Channel");
BasicDBObject basicDBObject = new BasicDBObject();
basicDBObject.put("name", "guilherme");
basicDBObject.put("state", "happy");
dBCollection.insert(basicDBObject);
}
}
Error: (14, 21) java: no suitable method found for insert (com.mongodb.BasicDBObject) method com.mongodb.DBCollection.insert (com.mongodb.DBObject ...) is not applicable (argument mismatch; com.mongodb.BasicDBObject can not be converted to com.mongodb.DBObject []) method com.mongodb.DBCollection.insert (java.util.List) is not applicable (argument mismatch; com.mongodb.BasicDBObject can not be converted to java.util.List)