vadimtsushko / objectory

Unsupported: Objectory - object document mapper for server-side and client side Dart applications
MIT License
55 stars 12 forks source link

match() does not work on the client #29

Closed kaisellgren closed 11 years ago

kaisellgren commented 11 years ago

This code:

$Group.match('name', 'Test');

Fails on the server:

#0      _JsonParser.error (package:bson/src/json_ext.dart:474:5)
#1      _JsonParser.parseString (package:bson/src/json_ext.dart:322:40)
#2      _JsonParser.parseBsonExtensionValue (package:bson/src/json_ext.dart:261:32)
#3      _JsonParser.parseObject (package:bson/src/json_ext.dart:283:50)
#4      _JsonParser.parseValue (package:bson/src/json_ext.dart:228:38)
#5      _JsonParser.parseObject (package:bson/src/json_ext.dart:289:33)
#6      _JsonParser.parseValue (package:bson/src/json_ext.dart:228:38)
#7      _JsonParser.parseList (package:bson/src/json_ext.dart:308:28)
#8      _JsonParser.parseValue (package:bson/src/json_ext.dart:229:38)
#9      _JsonParser.parseToplevel (package:bson/src/json_ext.dart:210:30)
#10     _JsonParser.parse (package:bson/src/json_ext.dart:172:47)
#11     JSON_EXT.parse (package:bson/src/json_ext.dart:54:29)
#12     ObjectoryClient.ObjectoryClient.<anonymous closure> (package:objectory/src/objectory_server_impl.dart:36:35)
#13     _StreamSubscriptionImpl._sendData (dart:async:1586:12)
#14     _StreamImpl._sendData.<anonymous closure> (dart:async:1362:29)
#15     _SingleStreamImpl._forEachSubscriber (dart:async:1446:11)
#16     _StreamImpl._sendData (dart:async:1360:23)
#17     _StreamImpl._add (dart:async:1162:16)
#18     StreamController.add (dart:async:1077:35)
#19     _WebSocketImpl._WebSocketImpl._fromSocket.<anonymous closure> (dart:io:7908:22)
#20     _StreamSubscriptionImpl._sendData (dart:async:1586:12)
#21     _StreamImpl._sendData.<anonymous closure> (dart:async:1362:29)
#22     _SingleStreamImpl._forEachSubscriber (dart:async:1446:11)
#23     _StreamImpl._sendData (dart:async:1360:23)
#24     _StreamImpl._add (dart:async:1162:16)
#25     StreamController.add.add (dart:async:1077:35)

I'm using:

Dart VM version: 0.5.0.1_r21823 (Mon Apr 22 14:03:05 2013)
objectory: 0.1.9
mongo_dart: 0.1.14
vadimtsushko commented 11 years ago

JsonExt does not support all Bson types. Notable not supported are BsonRegexp and BsonCode. Lately I tried to bring bson library to all platform - vm, dartium and (with some workarounds) dart2js, Last (github) version of objectory got rid of JsonExt and use bson for network communication. That may solve this issue and https://github.com/vadimtsushko/objectory/issues/18 also

Feel free to try it.

vadimtsushko commented 11 years ago

I've just published new version of objectory with bson based client/server communications

kaisellgren commented 11 years ago

I tried it, this is what I get now:

IsolateUnhandledException: exception while handling message: null 
  The null object does not have a getter 'codeUnits'.

  NoSuchMethodError : method not found: 'codeUnits'
  Receiver: null
  Arguments: []
original stack trace:
  #0      _throwDelayed.<anonymous closure> (dart:async:1133:5)
  #1      _asyncRunCallback._asyncRunCallback (dart:async:34:17)
  #2      _asyncRunCallback._asyncRunCallback (dart:async:44:9)
  #3      Timer.run.<anonymous closure> (dart:async:2251:21)
  #4      Timer.run.<anonymous closure> (dart:async:2259:13)
  #5      Timer.Timer.<anonymous closure> (dart:async-patch:15:15)
  #6      _Timer._createTimerHandler._handleTimeout (dart:io:6730:28)
  #7      _Timer._createTimerHandler._handleTimeout (dart:io:6738:7)
  #8      _Timer._createTimerHandler.<anonymous closure> (dart:io:6746:23)
  #9      _ReceivePortImpl._handleMessage (dart:isolate-patch:81:92)

It's not getting caught anywhere, so it goes to IsolateUnhandledException. Too bad we can't see the exact place where it throws... can you repro?

kaisellgren commented 11 years ago

It happens as simply as:

objectory.findOne($Group.match('name', 'test')).then(print);

Latest Objectory and SDK: 0.5.1.0_r22072

vadimtsushko commented 11 years ago

Fixed related bug in bson. Added test testMatch - passes successfully on all platforms