I'm executing a MongoDB script via the Kohana MangoDB ORM.
Here's the code to be executed:
var query {
date: date
};
var indexes = db.organisation_booking_indexes.find(query);
If I do .findOne(query) I get the specific result as an array. However just doing .find(query) returns other stuff like _mongo and _db instead of an array of the expected results.
How do I return just the documents I'm looking for?
It appears that some objects can't be returned "as is" using JS. In this case Mongo return the Cursor
Try:
This will convert the result in a "compatible" object. Take a look at this post to get more details: MongoDB: Error executing stored JavaScript function