-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmongolab.html
More file actions
39 lines (34 loc) · 986 Bytes
/
mongolab.html
File metadata and controls
39 lines (34 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="MongoLab.js"></script>
</head>
<body>
<script>
$(function(){
var mongoDB = new MongoLab('YOUR_API_KEY');
//list databases
mongoDB.listDatabases(function(data){
console.log('List Databases : ', data);
});
//list collections
mongoDB.listCollections('blog', function(data){
console.log('List Collections : ', data);
});
//list documents
mongoDB.listDocuments('blog', 'posts', function(data){
console.log('List Documents : ', data);
});
//insert documents
// mongoDB.insertDocuments('blog', 'posts', {JSLIBTEST : 'testing'}, function(data){
// console.log('Insert Documents : ', data);
// });
//delete document
mongoDB.deleteDocument('blog', 'posts', '50285146e4b0bd0b0bbb328a', function(data){
console.log('Delete Document : ', data);
});
});
</script>
</body>
</html>