Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Running stored functions from Java API
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Keith Branton  
View profile  
 More options Jan 18 2011, 11:51 am
From: Keith Branton <ke...@branton.co.uk>
Date: Tue, 18 Jan 2011 09:51:35 -0700
Local: Tues, Jan 18 2011 11:51 am
Subject: Re: [mongodb-user] Re: Running stored functions from Java API

> what is the difference with .eval and .doEval?
> The API doesn't say anything about them (or even the args). Why are
> you first running .doEval and then just .eval?

> The best documentation is well written code - always accurate and very

up-to-date. The mongo driver is pretty well written. The difference can be
seen nere:

    public CommandResult doEval( String code , Object ... args )
        throws MongoException {

        return command( BasicDBObjectBuilder.start()
                        .add( "$eval" , code )
                        .add( "args" , args )
                        .get() );
    }

    public Object eval( String code , Object ... args )
        throws MongoException {

        CommandResult res = doEval( code , args );

        if ( res.ok() ){
            return res.get( "retval" );
        }

        throw new MongoException( "eval failed: " + res );
    }

So eval simply wraps doEval, does a check for successful execution and
returns the "retval" value from the result.

I used eval because I wanted the result of the function call. You could
probably use eval for both calls - but once I got it working I didn't
investigate much more. I don't use eval any more - I replaced it with
findAndModify.

What I haven't found yet is much documentation on all the commands you can
execute with db.command, and their args :(

>  I've been told that
> "there is no way to go to production with mongo because it is loosing
> data".

I have not experienced this, and I fully plan to go into production using
Mongo in the next month or so.  Do you have any further details as to where
it's loosing data? I know about the following...

   - if you don't use WriteConcern.SAFE then it is possible for writes to
   fail and you will not be notified
   - if you write a lot and then query before the writes are all on disk
   then some may not be there yet
   - replication is necessary if durability is a requirement
   - you need a good optimistic-locking strategy if concurrent modifications
   are possible and you can't use the limited set of operation modifiers,
   otherwise later changes can overwrite previous changes

Are you aware of any other potential problems?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.