Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 46 lines (27 sloc) 2.574 kB
913918f @olegp first commit
authored
1 # Mongo Sync
2
a453f0f @olegp Update README.md
authored
3 Mongo Sync is a synchronous MongoDB driver for use with [Common Node](http://olegp.github.com/common-node/) that attempts to closely approximate the [MongoDB shell](http://www.mongodb.org/display/DOCS/dbshell+Reference).
53879a5 @olegp Update README.md
authored
4
2497449 @olegp closes #6
authored
5 It is a thin wrapper around the official MongoDB driver for Node. Here is a quick usage example that you can use with Common Node:
53879a5 @olegp Update README.md
authored
6
7 var Server = require("mongo-sync").Server;
8 var server = new Server('127.0.0.1');
9 var result = server.db("test").getCollection("posts").find().toArray();
10 console.log(result);
11 server.close();
a453f0f @olegp Update README.md
authored
12
13 For a complete application using this driver, check out [Notes](https://github.com/olegp/notes/).
14
b9e551c @olegp #10
authored
15 If you want to use Mongo Sync directly with [node-fibers](https://github.com/laverdet/node-fibers) (i.e. without Common Node), make sure all database requests occur within a fiber, e.g.:
53879a5 @olegp Update README.md
authored
16
b9e551c @olegp #10
authored
17 var Fiber = require('fibers');
18 Fiber(function() {
19 // set up goes here ...
20 var result = server.db("LashDB").getCollection("users").find().toArray();
b68361f @olegp #10
authored
21 }).run();
a58ed2e @olegp mailing list link added
authored
22
2f9fa92 @olegp #13
authored
23 ### Tests
24
9e56064 @olegp Update README.md
authored
25 [![Build Status](https://travis-ci.org/olegp/mongo-sync.svg?branch=master)](https://travis-ci.org/olegp/mongo-sync)
26
2f9fa92 @olegp #13
authored
27 Run the unit tests with the following command:
28
29 common-node test/test.js
30
a58ed2e @olegp mailing list link added
authored
31 ### Community
32
33 If you have any questions about using `mongo-sync` by itself or in conjunction with Common Node, please post them to the [Common Node mailing list](https://groups.google.com/forum/#!forum/common-node).
b9e551c @olegp #10
authored
34
913918f @olegp first commit
authored
35 ### License
36
37 (The MIT License)
38
39 Copyright (c) 2011+ Oleg Podsechin
40
41 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
42
43 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
44
b9e551c @olegp #10
authored
45 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Something went wrong with that request. Please try again.