in reply to Re^3: MongoDB Stored procedure from Dancer2
in thread MongoDB Stored procedure from Dancer2

Poj,

your suggestion is the right way, i will start from here.

I Just underline update is deprecated

@4000000058db6ef81e84eb6c # *** DEPRECATION WARNING *** @4000000058db6ef81e84eb6c # @4000000058db6ef81e84eb6c # The 'update' method will be removed in a f +uture major release. @4000000058db6ef81e84ef54 # Use $_, $_ or 'replace_one' instead.

so i made a little modification

my $col = $db->get_collection('counters'); $col->update_one({'_id' => 'comm-id'},{ '$inc' => { 'seq' => 1}}); my $id = $col->find_one({'_id' => 'comm-id'})->{'seq'};

so now it is working.

Thanks so much, it really help!

Replies are listed 'Best First'.
Re^5: MongoDB Stored procedure from Dancer2
by actarus2003 (Novice) on Nov 06, 2017 at 16:39 UTC
    Hi, sorry for long delay. I solved storing the function using mongo shell, then i had just to call in my procedure.