0

I am having the following error

ErrorException [ Fatal Error ]: Cannot use object of type stdClassàK´cðËÛ as array

Cannot use object of type stdClass as array (the above one is the exact line from my browser).

while I am running a codeigniter script with MongoDB database on Amazon EC2 instance. Same code is working for different amazon instance but while I am moving these codes into a new instance I am having this issue. Is it I am missing some installation (any sort of PHP library) or anything. I am also using Alex Bible's MongoQB. Any suggestions will be really helpful.

Thanks

1
  • The full stack trace and file/line of the exception would be helpful, or a minimal code example that triggers the error. Versions of the libraries you are using are also helpful. It's not clear from your post what the context of this error is. Commented Sep 6, 2013 at 17:29

2 Answers 2

1

I used the following in my MongoDb config file.

$config['mongo_return'] = 'array';
Sign up to request clarification or add additional context in comments.

Comments

0

You can easily cast an stdClass object to array, since it is just a container.

$array = (array) $object ;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.