Dear everybody who can help,
I have this PHP > MongoDB problem, I want to call a stored procedure (stored in db.system.js collection) via PHP.
I have no parameters, only a returning JSON object which looks like this:
{"archived":[the number of the archived messages]}
It works good in the shell on the database server, but when I try to call it via the PHP driver it just doesn’t “say” anything…
My code looks like this:
$DB->execute(
new MongoCode(
"function () { return archiveMessages(); }"
)
);
I have also tried to use somehow like this:
$DB->execute("archiveMessages()");
Please help, I’ve got stuck on this one… I only want to call that sh*t after updating the collection…
Thank you in advance,
B
Are you sure you’re using the same database? Try simplifying it to a basic example, e.g.,
Results in: