180 likes | 323 Views
Mongo DB Driver for WP7. Athens-Mongo DB-User-Group 3 rd Meeting By Nick Tsapakis. Intro. What is a Mongo DB driver Why WP7 Tools used How we worked Driver explained - Demo. Tools used. Netcat Wireshark WP7 SDK – VS2010 – C# Mongo DB. Specification. Mongo DB wire protocol
E N D
Mongo DB Driver for WP7 Athens-Mongo DB-User-Group 3rd Meeting By Nick Tsapakis
Intro • What is a Mongo DB driver • Why WP7 • Tools used • How we worked • Driver explained - Demo
Tools used • Netcat • Wireshark • WP7 SDK – VS2010 – C# • Mongo DB
Specification • Mongo DB wire protocol http://docs.mongodb.org/meta-driver/latest/legacy/mongodb-wire-protocol/
How we worked • Netcat used for sending data to socket without using a program • Data for sending placed in a file • Command used for sending data: nc127.0.0.1 27017 < data_file.txt
How we worked • Wireshark used for capturing commands – responses • Verifying that captured messages follow Mongo DB wire protocol specification • Sending commands we want to implement in driver (select, insert, delete)
How we worked • Visual Studio 2010 with WP7 SDK – Free (run apps on emulator) • Need registering the phone device as developer device – Not Free • Pay approx. 100 dollars for 1 year • I am telling you all !!!
Driver details • Driver consists of 2 classes • MongodbDriver.cs is actual Driver class • SocketClient.cs is a tcpcomms class used only by MongodbDriver.cs • MongodbDriver Methods available Find() , insert() , remove()
Messages Request – Reply • There will be no response sent for any other message except OP_QUERY and OP_GET_MORE messages • You can determine if a message was successful with a getLastError command • The database will respond to an OP_QUERY message with an OP_REPLY message • There is no response to an OP_DELETE message • There is no response to an OP_INSERT message
How to use Driver • Add as reference the 2 classes • Create MongodbDriver instance MongodbDriver mongo = new MongodbDriver(server, port, database, collection); • Call a method response = mongo.find(arguments); Arguments is a sting with following format (eg.) -> name:magic,pass:mypass,
What is supported • 3 methods supported for select, insert, delete • Only AND among input parameters on the 3 methods • Only string, Object ID types supported • No getLastErrorcommand supported • One OP_REPLY message supported • Tested on WP7 phone
Demo • Demo on WP7 SDK Emulator • Demo on a WP7 mobile device (Nokia Lumia)
Epilogue • Comments – suggestions • Ideas