Converting a mySQL table with id's to a MongoDB table with _id's -


i'm transferring mysql table mongodb. there primary key id in mysql table , want id converted _id in mongodb.

i use php's mongocollection::insert( $mysql_array );

however doesn't work because if set $mysql_array['_id'] seen mongo string instead of mongoid. tried $mysql_array['_id'] = new mongoid( $id ) doesn't allow me override default _id value. saw mysql's integer columns converted string mongocollection::insert(). if set mongocollection::insert() correctly transfer integer maybe work.

typecast _id integer value this...

(int) $mysql_array['_id']

you'll find doing lot in mongodb


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -