A
A
anonimizer_me2012-07-10 17:13:12
PHP
anonimizer_me, 2012-07-10 17:13:12

Why is the record not being inserted into Mongo?

Good afternoon.
Situation.

There is a user_data collection with fields login, key, value
Everything was ok. The data was inserted using the following method

$obj = self::model();
$obj->collection->update(array('login' => $login, 'key' => $key), array(
'$set' => array('value' => $value)
), array( 'upsert' => true));

But at one point, the records stopped inserting.
Tried doing this
$obj->collection->insert(array('login'=>$login, 'key'=>$key, 'value'=>$value));
But all the same records were not interposed. There were no mistakes.

If removed from the login array, then everything was inserted. Returned login and nothing was inserted.


Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
gaelpa, 2012-07-10
@gaelpa

Watched the load on the database at the time of failed inserts?
If you want it to actually insert, then add the safe:true option.

V
Vyacheslav Slinko, 2012-07-10
@KeepYourMind

Without safe => true, you will never know the result of the paste.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question