18
Mongo DB Driver for WP7 Athens-Mongo DB-User-Group 3 rd Meeting By Nick Tsapakis

Mongo DB Driver for WP7

Embed Size (px)

DESCRIPTION

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 - PowerPoint PPT Presentation

Citation preview

Page 1: Mongo DB Driver for WP7

Mongo DB Driver for WP7

Athens-Mongo DB-User-Group3rd Meeting

By Nick Tsapakis

Page 2: Mongo DB Driver for WP7

Intro

• What is a Mongo DB driver

• Why WP7

• Tools used

• How we worked

• Driver explained - Demo

Page 3: Mongo DB Driver for WP7

Tools used

• Netcat

• Wireshark

• WP7 SDK – VS2010 – C#

• Mongo DB

Page 5: Mongo DB Driver for WP7

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:

nc 127.0.0.1 27017 < data_file.txt

Page 6: Mongo DB Driver for WP7

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)

Page 7: Mongo DB Driver for WP7

How we worked

Page 8: Mongo DB Driver for WP7

How we worked

Page 9: Mongo DB Driver for WP7

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 !!!

Page 10: Mongo DB Driver for WP7

How we worked

Page 11: Mongo DB Driver for WP7

Driver details

• Driver consists of 2 classes

• MongodbDriver.cs is actual Driver class

• SocketClient.cs is a tcp comms class used only by MongodbDriver.cs

• MongodbDriver Methods availableFind() , insert() , remove()

Page 12: Mongo DB Driver for WP7

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

Page 13: Mongo DB Driver for WP7

Message Request structure

Page 14: Mongo DB Driver for WP7

Message Reply structure

Page 15: Mongo DB Driver for WP7

How to use Driver

• Add as reference the 2 classes

• Create MongodbDriver instanceMongodbDriver mongo = new MongodbDriver(server, port, database, collection);

• Call a methodresponse = mongo.find(arguments);

Arguments is a sting with following format (eg.) -> name:magic,pass:mypass,

Page 16: Mongo DB Driver for WP7

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 getLastError command supported

• One OP_REPLY message supported

• Tested on WP7 phone

Page 17: Mongo DB Driver for WP7

Demo

• Demo on WP7 SDK Emulator

• Demo on a WP7 mobile device (Nokia Lumia)

Page 18: Mongo DB Driver for WP7

Epilogue

• Comments – suggestions

• Ideas