Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

documentdb

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

documentdb - npm Package Compare versions

Comparing version 0.9.1 to 0.9.2

index.js

9

package.json
{
"name": "documentdb",
"description": "Nodejs client for documentdb",
"description": "Node.js client for documentdb",
"keywords": [

@@ -12,11 +12,8 @@ "documentdb",

],
"version": "0.9.1",
"version": "0.9.2",
"author": "Microsoft Corporation",
"main": "./documentclientwrapper.js",
"main": "./index.js",
"engine": {
"node": ">=0.8"
},
"dependencies": {
"q": "*"
},
"devDependencies": {

@@ -23,0 +20,0 @@ "mocha": "*",

@@ -12,15 +12,7 @@ <html>

</p>
<p>
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.
<p>
The Nodejs sdk uses callbacks model for responses and this is exposed in DocumentClient <br>
</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>

@@ -52,2 +44,3 @@ <p><pre style="background-color:#eee">

console.log('Created Document with content: ', document.content);
cleanup(client, database);
});

@@ -64,55 +57,14 @@ });

<h4>Hello world example code using Q promises</h4>
<p><pre style="background-color:#eee">
var DocumentClient = require('documentdb').DocumentClientWrapper;
##Community
- [DoQmentDB](https://github.com/a8m/doqmentdb) - A Promise-based DocumentDB client for MongoDB users
var host = [hostendpoint]; // Add your endpoint
var masterKey = [database account masterkey]; // Add the massterkey of the endpoint
var client = new DocumentClient(host, {masterKey: masterKey});
var databaseDefinition = { id: "sample database" }
var collectionDefinition = { id: "sample collection" };
var documentDefinition = { id: "hello world doc", content: "Hello World!" };
var database, collection, document;
client.createDatabaseAsync(databaseDefinition)
.then(function(databaseResponse) {
database = databaseResponse.resource;
return client.createCollectionAsync(database._self, collectionDefinition);
})
.then(function(collectionResponse) {
collection = collectionResponse.resource;
return client.createDocumentAsync(collection._self, documentDefinition);
})
.then(function(documentResponse) {
var document = documentResponse.resource;
console.log('Created Document with content: ', document.content);
cleanup(client, database);
})
.fail(function(error) {
console.log("An error occured", error);
});
function cleanup(client, database) {
client.deleteDatabaseAsync(database._self)
.then(function(response) {
console.log('clean up completed');
})
.fail(function(error){
console.log(error);
});
}
</pre></p>
<h4>Running the tests</h4>
<p><pre>
First You need to install mocha and q
First You need to install mocha
&gt; npm install mocha
&gt; npm install q
From the nodejsclient folder run
From the tests folder run
&gt; mocha -t 0 -R spec
</p></pre>
</body>
</html>
</html>

@@ -1,5 +0,5 @@

var masterKey = "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==";
var host = "https://localhost:443";
var host = "MyHost";
var key = "MyKey";
exports.host = host;
exports.masterKey = masterKey;
exports.masterKey = key;

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc