0

Given the following object:

var object = {
  'name': {
    test: 'one'
  },
  'test.two': 'test',
  'test.three.*': 'tes.two',
  'testfour': {
    'test.five': {
      'test.six': 'lorem ipsum'
    }
  } 
};

How do I replace all of the . in the keys sanitizing the object so as to insert it into a mongodb, is there a santize method I can use?

vimes1984
  • 1,684
  • 3
  • 26
  • 59
  • spaces underscores anything really... I'm basically trying to insert it into a mongodb and it' failing giving me: Error: key test.* must not contain '.' – vimes1984 Sep 22 '15 at 13:48
  • 2
    yeah I 'm looking through threads: http://stackoverflow.com/questions/12397118/mongodb-dot-in-key-name I'll mark this as a duplicate :D – vimes1984 Sep 22 '15 at 13:52

0 Answers0