Hi Im Trying to create a DataBase in MongoDB from C# code This is the code Im Useing
public partial class SqlToMongo : Form
{
public SqlToMongo()
{
InitializeComponent();
connectToMongo();
}
public void connectToMongo(){
var con = "mongodb://127.0.0.1";
MongoClient client = new MongoClient(con);
var db = client.GetDatabase("BetsOdds");
bool d = db.RunCommandAsync((Command<BsonDocument>)"{ping:1}")
.Wait(2000);
var Betsodds = db.GetCollection<BetOdds>("Betodds");
}
}
The ping return true when MongoService is running and false when the service is off, the code works. I'm using RoboMongo as a GUI for MongoDB and after the code runs i still don't see the Database on the GUI. i need some help what i'm doing wrong
Thanks