Yii Framework Forum: MongoDBS inserting null values? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

MongoDBS inserting null values? Rate Topic: -----

#1 User is offline   rapidtransit440 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 27
  • Joined: 29-March 10

Posted 17 May 2012 - 04:03 PM

This was driving me nuts for the better part of the day.

Quote

MongoException - zero-length keys are not allowed, did you use $ with double quotes?


Thinking I was screwing up somewhere, I kept reviewing and reviewing till I finally set

Quote

mongo.allow_empty_keys=true


 "prod_cats": {
     "0": {
       "prod_categories": "4fac1990c1ccc21d29000000",
       "": null 
    } 


Here's part of my form, the [0] is intended as a placeholder till I add a loop to it.
      <div class="row">
          
          <script type="text/javascript">
      $(document).ready(function() {

    $('#ProdCategories_0_prod_categories').val('<?php echo $model->prod_cats['0']['prod_categories']; ?>');

});</script>
          
          
          <?php
      
     $model->prod_cats[0] = new ProdCategories();
      ?>
            <div class="two columns"><?php echo $form->labelEx($model->prod_cats[0],'prod_categories'); ?></div>
            <div class="eight columns"><?php echo $form->dropDownList($model->prod_cats[0],"[0]prod_categories", $catList); ?>
            <?php echo $form->error($model->prod_cats[0],'prod_categories'); ?></div>
	</div>


Then my Controller
                    $model->prod_cats[0]= new ProdCategories;
$model->prod_cats[0]->prod_categories = $_POST['ProdCategories']['0']['prod_categories'];


I already have arrays of more complex embedded documents, this one is causing the most headaches :blink:
0

#2 User is offline   mattmatt 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 14-June 12

Posted 14 June 2012 - 08:30 AM

Hi,

I have the same problem ... Did you find the solution ?

Thanks,
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users