1. Ce site utilise des cookies. En continuant à utiliser ce site, vous acceptez l'utilisation des cookies. En savoir plus.
  2. Bonjour tout le monde ! Veillez consulter la Politique de forum pour comprendre nos règles, Merci a vous !
    Rejeter la notice

How to link MongoDB with windev & windev mobile?

Discussion dans 'Windev Mobile' créé par sanyad, Avr 8, 2020.

  1. sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    I successfull installed MongoDB in my Synology NAS with Docker and able to interface database with windev/windev mobile through LAN i.e. localhost:port number but not able to interface with it from outer world i.e. through DDNS on my Sunology NAS.
    Im also not able to link my windev/windev mobile apps with Mongodb server address like mongodb+srv://username:<password>@cluster0-h3pti.gcp.mongodb.net/test.
    I also can't link my windev/windev mobile projects with Firebase server of google for backend cloud database & file management.

    I any friend successfully linked WD apps with either Firebase or MongoDB may please help me to deliberate the method to do the same.
     
    Tags:
  2. LAPIPE2018

    LAPIPE2018 Active Member
    MEMBRE WX

    Inscrit:
    Fev 17, 2018
    Messages:
    648
    J'aime reçus:
    227
    Hi,
    The way you log on a normal server is same. You need and IP adress, the port and a running Mongodb on the server
     
    sanyad apprécie ceci.
  3. sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    Thanks for reply. I really appreciate. But my login script on a Mongodb server is like "mongodb+srv://username:<password>@cluster0-h3pti.gcp.mongodb.net/test" and there is no port indication in script. I am still not able to connect to mongodb server with " mongodb+srv://username:<password>@cluster0-h3pti.gcp.mongodb.net/test." link through my windev/windev mobile app. Will you please share an example of small script to connect with MongoDB server.
     
  4. popoy

    popoy Well-Known Member
    MEMBRE WX

    Inscrit:
    Fev 23, 2018
    Messages:
    2,882
    J'aime reçus:
    1,532

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!



    Unit examples (windev): Native access to MongoDB
    This example shows how to use the main functions of native access to MongoDB databases: adding data, reading (searching), modifying and deleting data in the database. The example also shows functions for saving files in the MongoDB GridFS data system.
     
    sanyad apprécie ceci.
  5. popoy

    popoy Well-Known Member
    MEMBRE WX

    Inscrit:
    Fev 23, 2018
    Messages:
    2,882
    J'aime reçus:
    1,532
    Download in wd25
    Code (Text):
    https://package.windev.com/pack/wx25/exemples/wx25_064/wd/fr/unitaire/acces natif a mongodb/76edcd6f123677fa5b6d7d4bef67c630.zip
     
    sanyad apprécie ceci.
  6. sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    Thanks Dear for quick advise.
    I already downloaded that example and used it to interface with my Synology NAS --> MongoDB Docker through an i.e. 192.168.1.23:4900 and working ok.
    Tried to use same MongoDB (inside Synology NAS --> Docker) from WAN (through DDNs and port mapping) --> Couldn't succeed to connect .
    Again tried to connect with original mongodb server with --> "mongodb+srv://username:<password>@cluster0-h3pti.gcp.mongodb.net/test" string replaced in connection string of same example and couldn't succeed to connect MongoDB server as in this string no port is specified.

    Just stuck as I have already managed database over Mongo server and want to make front end with windev & windev mobile.
    Can any friend just alter the downloaded example as mentioned in previous post and replace code to connect with original mongodb server please.
     
  7. sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!

    Download in wd25
    Code (Text):
    https://package.windev.com/pack/wx25/exemples/wx25_064/wd/fr/unitaire/acces natif a mongodb/76edcd6f123677fa5b6d7d4bef67c630.zip
    Cliquez pour agrandir...
    Sorry but I have v24.
     
  • popoy

    popoy Well-Known Member
    MEMBRE WX

    Inscrit:
    Fev 23, 2018
    Messages:
    2,882
    J'aime reçus:
    1,532
    The port 4900 is to hfsql
    Trial with 27017

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!

     
  • sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    Used this connection string but not able to connect:
    cntMDB is mongoConnection("mongodb+srv://sandeep:sandeep@cluster0-h3pti.mongodb.net/test?retryWrites=true&w=majority")
    FOR EACH MyDatabase OF cntMDB.Database
    Info(MyDatabase.Name)
    END

    When I execute a string, no response, no error nothing.
    Where I am wrong?

    Another code:
    cntMDB is mongoConnection
    cntMDB = MongoCreate("mongodb+srv://sandeep:sandeep@cluster0-h3pti.mongodb.net/test?retryWrites=true&w=majorit")
    FOR EACH MyDatabase OF cntMDB..Database
    Info(MyDatabase..Name)
    END
    This code shows following error :

    Error at line 12 of Click BTN_NoName1 process.
    A fatal error occurred on the element of 'mongoConnexion' type and prevents from using it.
    This error occurred at line 12 of the 'Click BTN_NoName1' process.
    The MongoDB <mongodb+srv://sandeep:sandeep@cluster0-h3pti.mongodb.net/test?retryWrites=true&w=majorit> connection string is not valid.
     
    #9 sanyad, Avr 9, 2020
    Dernière édition: Avr 9, 2020
  • sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    And how to pass parameters for authentication of MongoDb Database by windev mentioned in Environment of MongoDB Container inside docker like

    MONGO_INITDB_ROOT_USERNAME: "admin"
    MONGO_INITDB_ROOT_PASSWORD: "password"
    MONGO_INITDB_DATABASE: "database_name"

    When I declared these environment inside docker contained of MongoDB , I can't connect mongodb by Studio3T as well as other 3rd party connector and obviously with windev..
     
  • sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    Someone please help.
     
  • popoy

    popoy Well-Known Member
    MEMBRE WX

    Inscrit:
    Fev 23, 2018
    Messages:
    2,882
    J'aime reçus:
    1,532
    The port is not 4900 but 27017 on synology.
    I don't know Why it work on Windows with 4900.
     
    #12 popoy, Avr 12, 2020
    Dernière édition: Avr 12, 2020
  • sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    Hi. "Unit examples (windev): Native access to MongoDB" have been checked and I successfully connected with my Synology NAS Server (DOcker MongoDB) nut I am intended to connect to mongodb.com where my actual database is stored and continuously updated.
    The URI script like "mongodb+srv://sandeep:sandeep@cluster0-h3pti.mongodb.net/test?retryWrites=true&w=majority" is for connection with mongodb from windev. I tried with this script like
    gclConnection=MongoCreate("mongodb+srv://sandeep:sandeep@cluster0-h3pti.mongodb.net/test?retryWrites=true&w=majority") checked but error saying connection string invalid.

    Also tried gclConnection=MongoCreate("mongodb+srv://sandeep:sandeep@cluster0-h3pti.mongodb.net/test?retryWrites=true&w=majority:27017") - Same error

    Also tried
    gclConnection=MongoCreate("mongodb+srv://sandeep:sandeep@cluster0-h3pti.mongodb.net/test?retryWrites=true&w=majority:27017/Db_planner")
    but connection error is still there.

    In the example (supplied with windev), connection script example with MongoDB server (mongodb+srv://sandeep:s..... etc) is not supplied so even after a lot of hit and trials, I am not able to connect with Database collection.

    Kindly help me to connect with my MongoDB from windev at URI Script
    "mongodb+srv://sandeep:sandeep@cluster0-h3pti.mongodb.net/test?retryWrites=true&w=majority"
    Database - DB_Planner

    TIA
     
  • kdev66

    kdev66 New Member

    Inscrit:
    Mar 26, 2018
    Messages:
    22
    J'aime reçus:
    14
    Hello, to interface your windev or windev mobile app to mongodb in docker container you must use a webservice for example in nodejs it's not difficult and if you want i can help you and the group also about that.
     
    sanyad apprécie ceci.
  • popoy

    popoy Well-Known Member
    MEMBRE WX

    Inscrit:
    Fev 23, 2018
    Messages:
    2,882
    J'aime reçus:
    1,532
    mongodb.com is not mongodb.net and

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!

    is right, you must use a webservice.
     
  • sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    Hi kdev66 & poppy , Thanks for a reply. I successfully interfaced MongoDB in docker container (Of Synology NAS - mongodb://192.168.1.23:27017) and it is working well with my windev Project.
    I successfully interfaced same Docker Mongo DB (in my Synology NAS) by the DDNS server. I didn't need Webservice in both cases as MongoDB has native access with windev.
    My problem is to interface my app with actual MongoDB server at

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!

    which gives a URI string like ""mongodb+srv://sandeep:sandeep@cluster0-h3pti.mongodb.net/test?retryWrites=true&w=majority" to connect with the user app for interfacing with the database.
    I am not able to connect my Database Collection on "mongodb+srv://sandeep:sandeep@cluster0-h3pti.mongodb.net/test?retryWrites=true&w=majority" address as windev says wrong connection string. I know that access to MongoDB.com through URI is possible in windev but how?
    I need help for the scenario
    Please help meby sharing any script of node.js or other webservice to connect WD with MongoDB ..

    TIA
     
    #16 sanyad, Avr 13, 2020
    Dernière édition: Avr 13, 2020
  • sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    Pl

    Bonjour visiteur, Merci de vous Inscrire ou de vous connectez pour voir les liens!

    Hello, to interface your windev or windev mobile app to mongodb in docker container you must use a webservice for example in nodejs it's not difficult and if you want i can help you and the group also about that.
    Cliquez pour agrandir...
    Hi, please share the knowledgebase.... A small working project to interface ""mongodb+srv://sandeep:sandeep@cluster0-h3pti.mongodb.net/test?retryWrites=true&w=majority" (Username-sandeep, Password-sandeep) would be better. Just help how to connect my node.js with Webservice on a real mongodb server.
     
  • popoy

    popoy Well-Known Member
    MEMBRE WX

    Inscrit:
    Fev 23, 2018
    Messages:
    2,882
    J'aime reçus:
    1,532
    Try with
    "mongodb+srv://sandeep:sandeep@cluster0-h3pti.mongodb.com/test?retryWrites=true&w=majority"
     
  • sanyad

    sanyad Member

    Inscrit:
    Sept 27, 2019
    Messages:
    172
    J'aime reçus:
    7
    Tried but
    Error comes :
    WL call:
    Process of 'Click BTN_Connection_to_the_database' (WIN_MongoDB_9042020.BTN_Connection_to_the_database), line 4
    'MongoCreate' function, syntax 0

    What happened?
    The MongoDB <mongodb+srv://sandeep:sandeep@cluster0-h3pti.mongodb.com/test?retryWrites=true&w=majority> connection string is not valid.

    Error code: 770800
    Level: non-fatal error

    Dump of the error of 'wd240big.dll' module (24.0.92.0).
    Identifier of detailed information (.err): 770800
    Debugging information:
    IEWDBig=13.1
    Module=<WDBig>
    Version=<24.0.92.0>
    Fonction (77,15)
    Additional information:
    EIT_PILEWL :
    Click BTN_Connection_to_the_database (WIN_MongoDB_9042020.BTN_Connection_to_the_database), line 4
    EIT_DATEHEURE : 13/04/2020 20:35:36
    EIT_TYPE_WDFILE : <2>
    EIT_IDCODE : <18>
     
  • kdev66

    kdev66 New Member

    Inscrit:
    Mar 26, 2018
    Messages:
    22
    J'aime reçus:
    14
    Hello, I'm so sorry to be so late but i tried to have an easy example about webservice to interface windev mobile 24 with mongodb.
    My example for webservice is from github so it's easy to understand it's in nodejs.
    webservice and database are both in localhost but it's easy to try that online
    I did a simple interface in WM to try GET and POST
     

    Fichiers attachés:

    • 1.jpg
      1.jpg
      Taille de fichier:
      73.5 KB
      Affichages:
      23
    • GET.jpg
      GET.jpg
      Taille de fichier:
      417.2 KB
      Affichages:
      22
    • POST.jpg
      POST.jpg
      Taille de fichier:
      428.8 KB
      Affichages:
      18
  • Partager cette page

    Chargement...