{"issue":{"state":"closed","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"milestone":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/c1651aee65a9ddff7c7fa2a4b73f578d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"c1651aee65a9ddff7c7fa2a4b73f578d","url":"https://api.github.com/users/Dededede4","login":"Dededede4","id":367280},"assignee":null,"updated_at":"2011-11-15T04:53:55Z","labels":[],"closed_at":"2011-11-14T06:41:26Z","comments":5,"url":"https://api.github.com/repos/guileen/node-mongoskin/issues/16","body":"Hello,\r\nin the terminal mongo this works:\r\n\r\nvar f = function(){return (this.root.address.test('testRegex') && this.root.name === 'MyName')};\r\ndb.my.find(f);\r\n\r\nI can not do it on node.js:\r\nvar f = function(){return (this.root.address.test('testRegex') && this.root.name === 'MyName')};\r\ndb.my.find(f).toArray(feedback); //Cannot call method 'toArray' of undefined\r\n\r\nbut :\r\ndb.my.find().toArray(feedback);  // work\r\n\r\nan idea?\r\nthank you !\r\n","html_url":"https://github.com/guileen/node-mongoskin/issues/16","title":"search by function ?","number":16,"id":2220944,"created_at":"2011-11-13T10:55:01Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/c126ccb3b6cc4c87d127d2229340e754?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"c126ccb3b6cc4c87d127d2229340e754","url":"https://api.github.com/users/guileen","login":"guileen","id":249313},"updated_at":"2011-11-15T04:53:55Z","url":"https://api.github.com/repos/guileen/node-mongoskin/issues/comments/2740995","body":"There is no features of find by function\r\n\r\n在 2011-11-15 上午3:01，\"Dededede4\" <\r\nreply@reply.github.com\r\n>编写：\r\n\r\nI'm probably stupid :\r\n\r\n\r\nthis.db.find('function(){return true;}', function(err, cursor){\r\n        cursor.toArray(function(a, b){console.log(b);}); // null\r\n});\r\nthis.db.find('{}', function(err, cursor){\r\n        cursor.toArray(function(a, b){console.log(b);}); // null\r\n});\r\n\r\n\r\nthis.db.find({}, function(err, cursor){\r\n       cursor.toArray(function(a, b){console.log(b);}); // works (show all\r\nresults)\r\n});\r\nthis.db.find({'root.id':'0'}, function(err, cursor){\r\n       cursor.toArray(function(a, b){console.log(b);}); // works\r\n});\r\n\r\nthis.db.find(function(){return true;}, function(err, cursor){\r\n       cursor.toArray(function(a, b){console.log(b);}); // works (show all\r\nresults)\r\n});\r\nthis.db.find(function(){return false;}, function(err, cursor){\r\n       cursor.toArray(function(a, b){console.log(b);}); // no works (show\r\nall results)\r\n});\r\n\r\n\r\n---\r\nReply to this email directly or view it on GitHub:\r\nhttps://github.com/guileen/node-mongoskin/issues/16#issuecomment-2734848","id":2740995,"created_at":"2011-11-15T04:53:55Z"}}