1

I am running an app with Geddy JS (v 0.6.18) with a Mongo DB - Before saving models I am setting a custom id property. Nevertheless, Geddy JS (or Mongo DB?) seems to overwrite this custom id property with a String looking like:

EAF9AAD8-3A5D-462B-8733-376AB17ECBEC

Instead of my custom 10-length string.

This behaviuor did not occur before updating to the lastest version. Can anyone explain me, what's happending here and how I am able to turn this off?

Felix
  • 4,213
  • 1
  • 21
  • 27
  • I have not reproduced, but can you check the value of the autoincrement flag in your model? Or just set it to false and see if it works. – Miguel Madero Feb 25 '13 at 18:41
  • this is definitely not MongoDB that's doing this - it must be one of the layers above it. – Asya Kamsky Feb 25 '13 at 18:43
  • @MiguelMadero I haven't explicitly set it. Have to check. – Felix Mar 03 '13 at 11:57
  • Should it be in Geddy's model? Couldn't find anything there. – Felix Mar 06 '13 at 13:38
  • I'm also interested in this...Miguel, any thoughts? – Sorin Adrian Carbunaru Mar 12 '13 at 18:55
  • I have to specify that I don't use MongoDB... I'm just using the in-memory option – Sorin Adrian Carbunaru Mar 12 '13 at 19:32
  • @Felix, which version were you using before where this was working? I looked at the code and it seems like we have always been overwritting the id (not saying this is right). I also checked the objectid in the mongodb_wrapper and they check if it's not null before generating the id, so this is definately something to do with the model layer in geddy. Could you let me know the previous version number? – Miguel Madero Mar 13 '13 at 21:58
  • @SorinAdrianCarbunaru it looks like the in-memory adapter works this way. I'll have a look, both should let you override or change the type. – Miguel Madero Mar 13 '13 at 22:01
  • @MiguelMadero Before it was 0.4 something...it wasn't working on 0.6 something...I just updated to 0.7.7. It seems to have fixed the bug!? – Felix Mar 14 '13 at 08:22
  • I still have my id overwritten...if I have my own id property in the model, isn't this the way to save it? -> `id: params.id` – Sorin Adrian Carbunaru Mar 14 '13 at 17:48
  • I've forgot to tell that my input has the name `id`...so params.id should extract the value from the field, I guess – Sorin Adrian Carbunaru Mar 14 '13 at 18:18
  • @Felix cool (but odd since it seems to have the same issue, I added a few tests for this case to make sure all the adapters behave the same) – Miguel Madero Mar 14 '13 at 20:43
  • @SorinAdrianCarbunaru yes it should. You could test that separately, but even if you manually set in the controller myobject.id = "something" right before save it gets overwritten by the memoryAdapter . – Miguel Madero Mar 14 '13 at 20:45
  • yeah...it overwrites everything I try – Sorin Adrian Carbunaru Mar 14 '13 at 21:47

0 Answers0