Sausalito (Version 2.3.0)

24 views
Skip to first unread message

Marcus Döring

unread,
Nov 6, 2012, 3:47:28 AM11/6/12
to sausali...@googlegroups.com
Hi guys,

I'm trying to open a connection to a mongodb with sausalito 2.3.0 
(Downloaded the release containing the coreSDK and Sausalito IDE)
by following the examples at

The Problem I seem to have is that it does not find the mongodb driver which I include with
"import module namespace mongo = "http://www.28msec.com/modules/mongodb";"

The message i get is:
[err:XQST0059]: "http://www.28msec.com/modules/mongodb": target namespace not found for 

The message (at build-time) is always the same, no matter in which .xq-File i place this import.
I did create the test-project with the json template. (I also tried it with other templates, still the same)

So, I skimmed through the sdk.packages and there is nothing obviously refferencing mongodb.
Any help would be appreciated.

Cheers,
Marcus

William Candillon

unread,
Nov 6, 2012, 3:57:09 AM11/6/12
to sausali...@googlegroups.com
Hi Marcus,

This is a tricky one.
Currently, the mongodb module is not available in the CoreSDK.
This will be fixed in the next release.

In the meantime you have to deploy your app to the cloud to use the module.
For instance, the way the sandbox at http://www.28msec.com/sandbox/index is implemented, we send the JSONiq queries via HTTP and eval them on the backend.
This is how the code looks like:
module namespace s = "http://www.28msec.com/2.0/sandbox";

import module namespace mongo = "http://www.28msec.com/modules/mongodb";
import module namespace r = "http://www.zorba-xquery.com/modules/reflection";

declare %an:sequential function s:execute($query as xs:string)
{
  try {
      r:eval-s($query)
  } catch * { 
      {   
        res:set-status-code(500);
        <error code="{$err:code}" description="{$err:description}"
               module="{$err:module}" line-number="{$err:line-number}"
               column-number="{$err:column-number}" />
      }   
    }   
};

Of course you can hardcode MongoDB queries directly but there is no way to test them locally at the moment.
If you pick the sandbox-style approach to get started, you can hide your mongodb credentials in a variable that you will reference in the query to be eval'd.

Does this help?

Kind regards,

William

Marcus Döring

unread,
Nov 6, 2012, 7:11:37 AM11/6/12
to sausali...@googlegroups.com
Thanks for the quick reply.

This helps me a lot.
It sucks, but at least now I know that I can stop looking for an error on my end.
Can you give me an update on where you are in your development cycle for this new version (with local mongodb support)?

(Good thing that I just need it for a private project, so the "eval only in the cloud" isn't that much of a deal-breaker for me)

Cheers
Marcus
Reply all
Reply to author
Forward
0 new messages