mongodb - How do I clean the specific items in nested array -


i want remove items contain white spaces.

eg: " ", " "

i want remove them buy_items array.

how ? thanks

sample document

{   "_id": "mark jordan",   "records": [     {       "date": new date("2012-05-04t08:00:00+0800"),       "buy_items": [         "6829           ",         "               ",         "68600          ",         "8830           "       ]     },     {       "date": new date("2011-02-10t08:00:00+0800"),       "buy_items": [         "4659 ",         "     ",         "4660 "       ]     },     {       "date": new date("2011-01-09t08:00:00+0800"),       "buy_items": [         "     ",         "4659 "       ]     }   ] } 

you have same situation described in question: how check if line blank using regex

it's matter of applying search through array in monogodb:

http://docs.mongodb.org/manual/reference/operator/query/regex/


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -