NGUYEN TUAN ANH Active Member Licensed User Longtime User Oct 11, 2022 #1 Dear All, I have successfully connected to the MongoDB database, my "DEM" tbl has 20000 records i have done the following code but it doesn't work, the result always returns the value 0 Code: Copy Dim mongo As BANanoMongoDB mongo.Initialize(Main.Host, Main.DbPort, Main.Database, "DEM") mongo.position = 5 Dim ih As Int = mongo.GetInt("h") Log(ih) Could you please help me. ! Thank you very much Best Regards
Dear All, I have successfully connected to the MongoDB database, my "DEM" tbl has 20000 records i have done the following code but it doesn't work, the result always returns the value 0 Code: Copy Dim mongo As BANanoMongoDB mongo.Initialize(Main.Host, Main.DbPort, Main.Database, "DEM") mongo.position = 5 Dim ih As Int = mongo.GetInt("h") Log(ih) Could you please help me. ! Thank you very much Best Regards
Mashiane Expert Licensed User Longtime User Oct 12, 2022 #2 Hi it seems like you have not executed a select first before setting your position. Please check the code in the thread here Thread '[BANanoMongoDB] A helper class for everything MongoDB PHP CRUD.' https://www.b4x.com/android/forum/t...class-for-everything-mongodb-php-crud.138804/ Upvote 0
Hi it seems like you have not executed a select first before setting your position. Please check the code in the thread here Thread '[BANanoMongoDB] A helper class for everything MongoDB PHP CRUD.' https://www.b4x.com/android/forum/t...class-for-everything-mongodb-php-crud.138804/
NGUYEN TUAN ANH Active Member Licensed User Longtime User Oct 12, 2022 #3 Mashiane said: Xin chào, có vẻ như bạn đã không thực hiện một lần đầu tiên lựa chọn trước khi đặt vị trí của mình. Vui lòng kiểm tra mã trong chủ đề tại đây Chủ đề '[BANanoMongoDB] Một trợ giúp lớp cho mọi thứ MongoDB PHP CRUD.' https://www.b4x.com/android/forum/t...class-for-everything-mongodb-php-crud.138804/ Click to expand... Did you mean: before calling mongo.position = 5 , I have to do banano.Await(mongo.SelectWait) Upvote 0
Mashiane said: Xin chào, có vẻ như bạn đã không thực hiện một lần đầu tiên lựa chọn trước khi đặt vị trí của mình. Vui lòng kiểm tra mã trong chủ đề tại đây Chủ đề '[BANanoMongoDB] Một trợ giúp lớp cho mọi thứ MongoDB PHP CRUD.' https://www.b4x.com/android/forum/t...class-for-everything-mongodb-php-crud.138804/ Click to expand... Did you mean: before calling mongo.position = 5 , I have to do banano.Await(mongo.SelectWait)
Mashiane Expert Licensed User Longtime User Oct 12, 2022 #4 Yes, that is not an automatic call when you initialize the object Upvote 0
Mashiane Expert Licensed User Longtime User Oct 12, 2022 #5 Welcome... You can also do.. Do while mongodb.nextRow Dim r as map = mongodb.record Or Dim sname as string = mongodb.getstring("name") Loop Upvote 0
Welcome... You can also do.. Do while mongodb.nextRow Dim r as map = mongodb.record Or Dim sname as string = mongodb.getstring("name") Loop
Mashiane Expert Licensed User Longtime User Oct 12, 2022 #6 Please also if you don't mind, kindly visit all your questions and mark the solution given, this helps other people. I would greatly appreciate that. Upvote 0
Please also if you don't mind, kindly visit all your questions and mark the solution given, this helps other people. I would greatly appreciate that.
NGUYEN TUAN ANH Active Member Licensed User Longtime User Oct 14, 2022 #7 Mashiane said: Please also if you don't mind, kindly visit all your questions and mark the solution given, this helps other people. I would greatly appreciate that. Click to expand... Thank you Code: Copy Dim mongo As BANanoMongoDB mongo.Initialize(Main.Host, Main.DbPort, Main.Database, "DEM") mongo.ClearWhere mongo.AddWhere("k", mongo.EQ_OP, 5) banano.Await(mongo.SelectWait) Dim row As Map = mongo.result.Get(0) Dim ih As Int = row.Get("h") Log(ih) Upvote 0
Mashiane said: Please also if you don't mind, kindly visit all your questions and mark the solution given, this helps other people. I would greatly appreciate that. Click to expand... Thank you Code: Copy Dim mongo As BANanoMongoDB mongo.Initialize(Main.Host, Main.DbPort, Main.Database, "DEM") mongo.ClearWhere mongo.AddWhere("k", mongo.EQ_OP, 5) banano.Await(mongo.SelectWait) Dim row As Map = mongo.result.Get(0) Dim ih As Int = row.Get("h") Log(ih)
Mashiane Expert Licensed User Longtime User Oct 14, 2022 #8 Perfect, just like I said in post #2 that you need to execute a select first. Please mark that as a solution to close this thread. Thank you. Upvote 0
Perfect, just like I said in post #2 that you need to execute a select first. Please mark that as a solution to close this thread. Thank you.