Can I Store the JavaScript Map Object in Meteor's MongoDB? -


i have following code:

mymapfield = new map();  (var = stuff.length; i--; ) {     mymapfield.set(stuff.id, { name: stuff.name, type: types.my_type }); }  meteor.users.update(meteor.userid(), {         $set: { 'profile.mymapfield': mymapfield }     }); 

it doesn't work , error message doesn't ("undefined").

is there way store javascript map object in meteor's mongodb?

i don't think there direct way insert map object mongodb of now. possible workaround can suggest :

  1. iterate on map object, and
  2. store key-value pairs separately in db

the schema might this:

{   _id: someid,   map: [{          key: key1,          value: value1        },{          key: key2,          value: value2        },{          key: key3,          value: value3        },{          key: key4,          value: value4        },{          ...        }] } 

helper functions convert map objects format , vice-versa have written effect.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -