Skip to content

Instantly share code, notes, and snippets.

@Narigo
Created February 22, 2013 16:24
Show Gist options
  • Select an option

  • Save Narigo/5014601 to your computer and use it in GitHub Desktop.

Select an option

Save Narigo/5014601 to your computer and use it in GitHub Desktop.
Figured it out - shouldn't wait for "insertFuture" but wait for the end of the new future returned by insertFuture.andThen(...). Same for the result of the find in the end: The future needs to wait until the "res" future/promise is done (Await.result(res)), otherwise it would show up "None".
$ mongo
MongoDB shell version: 2.2.3
connecting to: test
> use test
switched to db test
> db['vertx-test'].find()
{ "_id" : ObjectId("51279b6539c0d003769abc36"), "nickname" : "Tester", "data" : { "age" : 15, "address" : "Fakestreet 123" } }
SLF4J: The following loggers will not work because they were created
SLF4J: during the default configuration phase of the underlying logging system.
SLF4J: See also http://www.slf4j.org/codes.html#substituteLogger
SLF4J: reactivemongo.api.Failover
17:23:01.418 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MongoDBSystem - received a checked write request
17:23:01.490 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MongoDBSystem - single node, update...NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set())),CONNECTED,None)))
17:23:01.494 [mongodb-akka.actor.default-dispatcher-4] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.495 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MongoDBSystem - NodeSet is now NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60],NotConnected,Set()), MongoChannel([id: 0xf7679bcf],NotConnected,Set()), MongoChannel([id: 0x8674bf24],NotConnected,Set()), MongoChannel([id: 0xfb13fdfe],NotConnected,Set()), MongoChannel([id: 0xda21176e],NotConnected,Set()), MongoChannel([id: 0x8286e605],NotConnected,Set()), MongoChannel([id: 0x55be73bc],NotConnected,Set()), MongoChannel([id: 0xfe7246f0],NotConnected,Set()), MongoChannel([id: 0xad5c5d03],NotConnected,Set())),PRIMARY,None)))
17:23:01.504 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MongoDBSystem - AUTH: nothing to do. authenticationHistory is AuthHistory(List())
17:23:01.505 [mongodb-akka.actor.default-dispatcher-4] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.505 [mongodb-akka.actor.default-dispatcher-4] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.506 [mongodb-akka.actor.default-dispatcher-4] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.507 [mongodb-akka.actor.default-dispatcher-4] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.507 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.508 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.509 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.509 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.509 [mongodb-akka.actor.default-dispatcher-4] DEBUG r.core.actors.MongoDBSystem - single node, update...NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],NotConnected,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],NotConnected,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.510 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.510 [mongodb-akka.actor.default-dispatcher-4] DEBUG r.core.actors.MongoDBSystem - NodeSet is now NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],NotConnected,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],NotConnected,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.510 [mongodb-akka.actor.default-dispatcher-4] DEBUG r.core.actors.MongoDBSystem - AUTH: nothing to do. authenticationHistory is AuthHistory(List())
17:23:01.511 [mongodb-akka.actor.default-dispatcher-4] DEBUG r.core.actors.MongoDBSystem - single node, update...NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],NotConnected,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],NotConnected,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.511 [mongodb-akka.actor.default-dispatcher-4] DEBUG r.core.actors.MongoDBSystem - NodeSet is now NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],NotConnected,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],NotConnected,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.511 [mongodb-akka.actor.default-dispatcher-4] DEBUG r.core.actors.MongoDBSystem - AUTH: nothing to do. authenticationHistory is AuthHistory(List())
17:23:01.512 [mongodb-akka.actor.default-dispatcher-4] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.512 [mongodb-akka.actor.default-dispatcher-4] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.512 [mongodb-akka.actor.default-dispatcher-4] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.512 [mongodb-akka.actor.default-dispatcher-4] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.513 [mongodb-akka.actor.default-dispatcher-4] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.513 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - single node, update...NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.514 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.514 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - NodeSet is now NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.514 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - AUTH: nothing to do. authenticationHistory is AuthHistory(List())
17:23:01.514 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.515 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - single node, update...NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.515 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.515 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - NodeSet is now NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.516 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - AUTH: nothing to do. authenticationHistory is AuthHistory(List())
17:23:01.516 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.517 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - single node, update...NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.517 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.517 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - NodeSet is now NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.518 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - AUTH: nothing to do. authenticationHistory is AuthHistory(List())
17:23:01.518 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.519 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - single node, update...NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.519 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.519 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - NodeSet is now NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.520 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - AUTH: nothing to do. authenticationHistory is AuthHistory(List())
17:23:01.520 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.521 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - single node, update...NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.521 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.522 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - NodeSet is now NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.522 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - AUTH: nothing to do. authenticationHistory is AuthHistory(List())
17:23:01.522 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.523 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - single node, update...NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.523 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.523 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - NodeSet is now NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.524 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - AUTH: nothing to do. authenticationHistory is AuthHistory(List())
17:23:01.524 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.524 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - single node, update...NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.525 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.525 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - NodeSet is now NodeSet(None,None,Vector(Node(localhost:27017,Vector(MongoChannel([id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xbb0c0c60, /127.0.0.1:45854 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xf7679bcf, /127.0.0.1:45855 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8674bf24, /127.0.0.1:45856 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfb13fdfe, /127.0.0.1:45857 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xda21176e, /127.0.0.1:45858 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x8286e605, /127.0.0.1:45859 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0x55be73bc, /127.0.0.1:45860 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xfe7246f0, /127.0.0.1:45861 => localhost/127.0.0.1:27017],Ready,Set()), MongoChannel([id: 0xad5c5d03, /127.0.0.1:45862 => localhost/127.0.0.1:27017],Ready,Set())),PRIMARY,None)))
17:23:01.525 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MongoDBSystem - AUTH: nothing to do. authenticationHistory is AuthHistory(List())
17:23:01.525 [mongodb-akka.actor.default-dispatcher-3] DEBUG r.core.actors.MonitorActor - set: a primary is available
17:23:01.960 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MongoDBSystem - received a checked write request
17:23:01.964 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MongoDBSystem - Sending request expecting response Request(3001,0,Insert(0,test.vertx-test),BufferSequence(DynamicChannelBuffer(ridx=0, widx=74, cap=128),WrappedArray()),None) by channel [id: 0xe8dec8dd, /127.0.0.1:45853 => localhost/127.0.0.1:27017] of node localhost:27017
17:23:01.985 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MongoDBSystem - Got a response from -388052771! Will give back message=Response(MessageHeader(83,212,3001,1),Reply(8,0,0,1),LittleEndianHeapChannelBuffer(ridx=36, widx=83, cap=83),ResponseInfo(-388052771)) to promise scala.concurrent.impl.Promise$DefaultPromise@4a28a7f7
17:23:01.986 [mongodb-akka.actor.default-dispatcher-2] DEBUG r.core.actors.MongoDBSystem - {3001} it's a getlasterror
done!
This shows up!
package reactivemongotest
import scala.concurrent.Await
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.concurrent.duration.DurationInt
import org.junit.Test
import reactivemongo.api.MongoConnection
import reactivemongo.bson.BSONDocument
import reactivemongo.bson.BSONInteger
import reactivemongo.bson.BSONString
import reactivemongo.bson.handlers.DefaultBSONHandlers.DefaultBSONDocumentReader
import reactivemongo.bson.handlers.DefaultBSONHandlers.DefaultBSONDocumentWriter
import reactivemongo.bson.handlers.DefaultBSONHandlers.DefaultBSONReaderHandler
class ReactiveMongoTest {
@Test
def someTest() {
import scala.concurrent.ExecutionContext.Implicits.global
val connection = MongoConnection(List("localhost:27017"))
val db = connection("plugin")
val collection = db("vertx-test")
val document = BSONDocument(
"nickname" -> BSONString("Tester"),
"data" -> BSONDocument(
"age" -> BSONInteger(15),
"address" -> BSONString("Fakestreet 123")))
val insertFuture = collection.insert(document)
insertFuture andThen {
case _ =>
val query = BSONDocument("data" -> BSONDocument("age" -> BSONInteger(15)))
val filter = BSONDocument("nickname" -> BSONInteger(1))
println("This shows up!")
val cursor = collection.find(query, filter)
println("This doesn't show up!")
val res = for {
maybeNickname <- cursor.headOption
result <- Future(maybeNickname.map({
nickname =>
nickname
}))
} yield result
println("result: " + res)
}
Await.result(insertFuture, 15 seconds)
println("done!")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment