This commit is contained in:
nomiero 2014-08-23 00:55:41 -07:00
Родитель 8949069725
Коммит a0cecc6cb7
1 изменённых файлов: 16 добавлений и 26 удалений

Просмотреть файл

@ -5,26 +5,18 @@
<body>
<h2>Windows Azure DocumentDB nodejs SDK</h2>
<p>
DocumentDB is a purpose built NoSQL JSON document database designed for modern mobile and web applications. DocumentDB supports rich queries over JSON data as well as, <br>
transactional execution of JavaScript based application logic. DocumentDB is built with a deep commitment to the JSON data model enabling it to offer differentiated query and data <br>
processing capabilities that scale to meet the needs of the most demanding modern applications.
</p>
<p>
DocumentDB is a purpose built NoSQL JSON document database designed for modern mobile and web applications. DocumentDB supports rich queries over JSON data as well as
transactional execution of JavaScript based application logic. <br>
DocumentDB is built with a deep commitment to the JSON data model enabling it to offer differentiated query and data
processing capabilities that scale to meet the needs of the most demanding modern applications. <br><br>
The Nodejs sdk has two API models: <br>
Callback model: where all calls use callbacks for responses and this is exposed in DocumentClient.
Promises model: where all calls use Q promises for responses ( this one is built on top of the callback model and this is exposed in DocumentClientWrapper.
Callback model: where all calls use callbacks for responses and this is exposed in DocumentClient. <br>
Promises model: where all calls use Q promises for responses ( this one is built on top of the callback model and this is exposed in DocumentClientWrapper.
</p>
<h4>Installing the library from nodejsclient folder</h4>
<p><pre>&gt; npm install nodejsclient</pre></p>
<h4>Installing the library using npm</h4>
<p><pre>&gt; npm install documentdb</pre></p>
<h4>Hello world example code using callbacks</h4>
<p><pre style="background-color:#eee">
<h4>Installing the library using npm</h4>
<p><pre>npm install documentdb</pre></p>
<h4>Hello world example code using callbacks</h4>
<p><pre style="background-color:#eee">
var DocumentClient = require('documentdb').DocumentClient;
var host = [hostendpoint]; // Add your endpoint
@ -39,7 +31,7 @@ client.createDatabase(databaseDefinition, function(err, database) {
if(err) return console.log(err);
console.log('created db');
client.createCollection(database._self, collectionDefinition, function(err, collection) {
client.createCollection(database._self, collectionDefinition, function(err, collection) {
if(err) return console.log(err);
console.log('created collection');
@ -55,10 +47,9 @@ client.createDatabase(databaseDefinition, function(err, database) {
function cleanup(client, database) {
client.deleteDatabase(database._self, function(err) {
if(err) console.log(err);
})
});
}
</pre></p>
<h4>Hello world example code using Q promises</h4>
<p><pre style="background-color:#eee">
var DocumentClient = require('documentdb').DocumentClientWrapper;
@ -101,7 +92,6 @@ function cleanup(client, database) {
});
}
</pre></p>
<h4>Running the tests</h4>
<p><pre>
First You need to install mocha and q
@ -109,7 +99,7 @@ First You need to install mocha and q
&gt; npm install q
From the nodejsclient folder run
&gt; mocha -t 0 -R spec
&gt; mocha -t 50000 -R spec
</p></pre>
</body>
</html>