Giter Site home page Giter Site logo

Comments (7)

aheckmann avatar aheckmann commented on June 10, 2024

Does it hang if run in the mongodb console? If not, does it hang if run
with just the node driver?

mongodb, node, mongoose, and plugin versions please.

On Friday, September 27, 2013, Matthew Conlen wrote:

e.g.

search: function(req, res, next) {
MyModel.textSearch(req.params.searchstring, function(err, output) {
if(err) {
console.log(err);
}
res.json(_.map(output.results, function(r) {return r.obj} ));
})
}

will output no error string and never return if MyModel doesn't have any
records


Reply to this email directly or view it on GitHubhttps://github.com//issues/4
.

Aaron
@aaronheckmann https://twitter.com/#!/aaronheckmann
soundcloud.com/ajhecky
github.com/aheckmann

from mongoose-text-search.

mathisonian avatar mathisonian commented on June 10, 2024

Added the versions to the original post.

From the mongo console:

db.modelname.runCommand("text", {search: "searchterm"})
{
    "queryDebugString" : "searchterm||||||",
    "language" : "english",
    "results" : [ ],
    "stats" : {
        "nscanned" : 0,
        "nscannedObjects" : 0,
        "n" : 0,
        "nfound" : 0,
        "timeMicros" : 9281
    },
    "ok" : 1
}

Returns correctly. Will check using node driver

from mongoose-text-search.

frty2 avatar frty2 commented on June 10, 2024

I have a similar problem. No result, no error, etc... even with data in the collection.

Using the mongo cmd I get the error "too many text index for: ..", even if i don't create an index on the collection. Is there some sort of auto text index creation for mongoose?

Why is this error not passed to the callback?

from mongoose-text-search.

feaber avatar feaber commented on June 10, 2024

The problem with forever hangs is that callback function is never executed and You probably return nothing to the browser.

As far as I investigated the problem can be related with recent changes in mongodb project:
./mongodb/lib/mongodb/db.js

in:Db.prototype.command function

from mongoose-text-search.

aheckmann avatar aheckmann commented on June 10, 2024

can't reproduce this.

@frty2 yes mongoose auto-creates indexes when you call var m = mongoose.model(X, schema). You can listen for errors with m.on('index', callback).

@feaber interesting. i'm aware of some poor error swallowing behavior by the driver. not sure if its been fixed yet.

I'm going to close unless there's more to go on. If you can reliably reproduce, please submit more information or better yet, a pull request with the fix and a test.

from mongoose-text-search.

matejkramny avatar matejkramny commented on June 10, 2024

issue could be that the text search isn't enabled on your mongo.. Wasn't on mine, and was hanging forever..

from mongoose-text-search.

feaber avatar feaber commented on June 10, 2024

Nah, it was my code :(
I was connecting / closing connection in every action.
When I test with "var db = mongoose.connect(mongo_uri);" on top of main js file, it started to work.
Looks like textSearch when is execuded had no valid connection.
The db driver will not run callback if there is no connection.

I think I have to read more about proper handling db connections in node.js :)

Regards,
Konrad.

from mongoose-text-search.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.