SergejJurecko/erlmongo

findandmodify

biancalana opened this issue · 5 comments

I'm trying to do

db.runCommand( { findandmodify: 'RandomStrings', query: {name: {'$ne': 'position'}}, sort: {}, remove: 1 });

using erlmong with:

runCmd("{ findandmodify: 'RandomStrings', query: {name: {'$ne': 'position'}}, sort: {}, remove: true}"),

I'm getting the following error:

[[{<<"errmsg">>,<<"no such cmd">>}, {<<"bad cmd">>,
[{<<"findandmodify: 'RandomStrings', query: {name: {'$ne': 'position'}}, sort: {}, remove">>,1}]}

Would you sugest any thing better ?

Thank you

This is a working finandmodify command from erlmongo:
Mong:runCmd([{"findandmodify", "file"},{"query", [{"fn","onmeta.flv"},{"ch","somechan"}]},{"remove",1}]).

Thank you !!

This worked for me

Mongo:runCmd([{"findandmodify", "RandomStrings"},{"query", [{"name",{ne, "position"}}]},{"remove",1}])

Hi ! I Another question

After execute runCmd as describe above I can't add a file via gfsNew with

Mongo:gfsNew(FileName, [{oid, DocId}])

I get the following error

Error in process <0.71.0> with exit value: {function_clause,[{mongodb,hex2dec,[<<0 bytes>>,"s0000"]},{mongodb,encode_element,1},{mongodb,'-encode/1-fun-0-',2},{lists,foldl,3},{mongodb,encode,1},{mongodb,gfs_proc,2}]}

Do I have to call any function to clean the cursor or something ??
Can I sugest something ?

Thank you

What is DocId? Serialization of that fails. Is it an actual mongo document ID (generated by the driver) or something you set? If it's just a string that you set, don't use {oid,DocId}, just DocId.

Thank you !

I'm now generating my own _id, so just using DocId instead {oid, DocId} solved.

Thank for this great peace of software.

Regards,
Alexandre