client hang at findAndModify operation after mongodb stopped?

68 views
Skip to first unread message

linbo liao

unread,
Apr 11, 2014, 12:04:55 AM4/11/14
to node-mong...@googlegroups.com
Hi,

In my app, I set mongodb connection options as auto_connect.

        auto_reconnect: true,
        socketOptions:{
            socketTimeoutMS: 5000,
            connectTimeoutMS: 5000,
            keepAlive: 1
        }

If mongodb stopped,  code will hang at findAndModify step.  Checking findAndModify  can't find any timeout options.

Any solution?

Christian Kvalheim

unread,
Apr 11, 2014, 5:14:36 AM4/11/14
to node-mong...@googlegroups.com
first steps are always

1. what node version
2. what driver version
3. what mongodb version
4. a minimum piece of code and instructions to reproduce the problem

linbo liao

unread,
Apr 11, 2014, 6:49:13 AM4/11/14
to node-mong...@googlegroups.com
Node:  v0.10.26
Mongodb:   v2.4.10
driver:    "mongoskin": "1.3.20"

appCollection   {"app": appname, "count": number}
 
 
appCountCollection.findAndModify({"app": app},[], {"$inc": {"count": 1}}, {upsert: true, new: true}, function(err, result){
                    if(err){
                        console.error("Modify app count failed", err);
                        callback(err);


在 2014年4月11日星期五UTC+8下午12时04分55秒,linbo liao写道:

Kevin Miller

unread,
Apr 11, 2014, 9:06:40 AM4/11/14
to node-mong...@googlegroups.com
Per the mongodb documentation:
Must specify either the remove or the update field in thefindAndModify() method. Removes the document specified in the update field. Set this to true to remove the selected document . The default is false.




--
You received this message because you are subscribed to the Google Groups "node-mongodb-native" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-mongodb-na...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

linbo liao

unread,
Apr 14, 2014, 3:29:14 AM4/14/14
to node-mong...@googlegroups.com
Refer to mongodb node document, http://mongodb.github.io/node-mongodb-native/api-generated/collection.html#findandmodify

only remove options, no update options. And my example will only update the document, won't remove.

Thanks,
Linbo

在 2014年4月11日星期五UTC+8下午9时06分40秒,Kevin Miller写道:
To unsubscribe from this group and stop receiving emails from it, send an email to node-mongodb-native+unsub...@googlegroups.com.

linbo liao

unread,
Apr 14, 2014, 3:59:52 AM4/14/14
to node-mong...@googlegroups.com
Looks it is an Mongodb issue.

Thanks,
Linbo

在 2014年4月14日星期一UTC+8下午3时29分14秒,linbo liao写道:
Reply all
Reply to author
Forward
0 new messages