AngelGabriel Posted September 2, 2013 Share Posted September 2, 2013 Hi. I need check existing doc in collection. public function insertMuvik( $mu ) { if( is_array( $mu ) ) { foreach( $mu AS $k => $v ) { if( !in_array( $k, self::$allow ) ) { unset( $mu[$k] ); } } $docOnTtitle = Base::$db->objects->find( array( 'title' => $mu['title'] ) )->count(); $docOnYoutubeID = Base::$db->objects->find( array( 'youtube_id' => $mu['youtube_id'] ) )->count(); if ( !$docOnTtitle && !$docOnYoutubeID ) { $res = Base::$db->objects->insert( $mu ); if( $res['err'] == NULL ) { return $mu['_id']; } } else { return false; } } return false; } this method, do not work. maybe need try $exist. Pleas help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.