Interfacing with mongodb

Just starting out? Need help? Post your questions and find answers here.
los
New User
New User
Posts: 6
Joined: Sun Apr 05, 2009 4:28 am
Location: USA

Interfacing with mongodb

Post 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!
los
New User
New User
Posts: 6
Joined: Sun Apr 05, 2009 4:28 am
Location: USA

Re: Interfacing with mongodb

Post 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?
User avatar
Danilo
Addict
Addict
Posts: 3037
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Interfacing with mongodb

Post 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.
los
New User
New User
Posts: 6
Joined: Sun Apr 05, 2009 4:28 am
Location: USA

Re: Interfacing with mongodb

Post by los »

Ah I see.. thanks! I'm going to give it a try
giammy
User
User
Posts: 16
Joined: Wed Aug 03, 2011 10:43 am

Re: Interfacing with mongodb

Post by giammy »

someone can post a code example with the import and use in PB of C API mongodb functions?
thanks in advance!
Topilno
New User
New User
Posts: 6
Joined: Mon Sep 22, 2008 8:41 pm

Re: Interfacing with mongodb

Post by Topilno »

You could consider accessing through an ODBC driver.

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