Page 1 of 1

Interfacing with mongodb

Posted: Sun Sep 23, 2012 11:35 pm
by los
I need to create some cross-platform tools that will be interfacing with the NOSQL database "mongodb". Since I'm doing this of my own accord, I figured why not have a good time doing it, so naturally my thoughts turned to PB :D

There is a mongodb driver for C described here http://api.mongodb.org/c/current/index.html -- It seems that the C language driver is very complete.

My questions for you good people:

1. Will it be easy interfacing using the C language driver from PB? By easy, I mean easier than if there wasn't such a well-documented and current C driver?
2. Is it possible to interface to the C language driver on multiple platforms (Windows, OSX, and Linux)?
2. Is it possible to attempt this using the PB trial, and then take the plunge if it looks like it will work out?

I know (because I lurk here for years now) that people are always asking about interfacing to some external library, but for some reason my searching here didn't turn up a similar case. But I apologize if this is a worn out FAQ.

Thanks for any advice!

Re: Interfacing with mongodb

Posted: Mon Sep 24, 2012 3:17 am
by los
Actually, looking at that C library, I think that I misunderstood the task at hand here. Since the only thing available is C source code, wouldn't that mean that the only way to get PB to interface with mongodb the same way would be to re-write the C code in PB?

Re: Interfacing with mongodb

Posted: Mon Sep 24, 2012 3:48 am
by Danilo
los wrote:Actually, looking at that C library, I think that I misunderstood the task at hand here. Since the only thing available is C source code, wouldn't that mean that the only way to get PB to interface with mongodb the same way would be to re-write the C code in PB?
If you compile the C driver source to .obj/.lib or .dll+.lib, you should be able to use it with PureBasic.
You would just have to write ImportC function declarations for the .lib functions.

Re: Interfacing with mongodb

Posted: Mon Sep 24, 2012 5:33 am
by los
Ah I see.. thanks! I'm going to give it a try

Re: Interfacing with mongodb

Posted: Tue Nov 10, 2015 10:45 am
by giammy
someone can post a code example with the import and use in PB of C API mongodb functions?
thanks in advance!

Re: Interfacing with mongodb

Posted: Thu Feb 14, 2019 6:33 pm
by Topilno
You could consider accessing through an ODBC driver.

https://www.mongodb.com/blog/post/odbc- ... telligence