EastolfiWebDev/MongoPortable


Solution for a MongoDB-like portable database

License: Other

Language: TypeScript


MongoPortable

Solution for a MongoDB-like portable database.

Package Version NodeJS Version

Linux Build Windows Build Codeship Build

Test Coverage Downloads Documentation Status

It handles the collections and documents in memory, and allow the use of stores for persistence.

Installation

npm install --save mongo-portable

Usage

// Declaring the module dependency
var MongoPortable = require("mongo-portable").MongoPortable;

// Instantiates a new ddbb object by passing a ddbb name
var db = new MongoPortable("TEST");

// Creates a new collection named "users" 
//      (if it's already created, it will just return it instead)
var users = db.collection("users");

// Inserts a new document into the collection
var document = users.insert({ name: "John", lastName: "Abruzzi" });
console.log(document);  // -> { name: "John", lastName: "Abruzzi" }

// Creates a cursor with the query information, ready to be fetched
var cursor = users.find({ name: "John" });

// Iterates over the cursor, obtaining each document that matchs the query
cursor.forEach(function(doc) {
    console.log(doc);  // -> { name: "John", lastName: "Abruzzi" }
});

Modules

The modules visibles for an application are MongoPortable, Collection and Cursor.

MongoPortable

Handles the database, collections and connections.

Read the full API documentation here

Collection

Handles the list of documents by using cursors.

Read the full API documentation here

Cursor

Fetchs and access the documents to return them to the client.

Read the full API documentation here


Stores

File System Store

It is located in a separated module, so install it by:

npm install --save file-system-store

And then use it in your application by adding it in your MongoPortable instance:

var FileSystemStore = require("file-system-store");
db.addStore(FileSystemStore);

or as a middleware:

var FileSystemStore = require("file-system-store");
db.use("store", FileSystemStore);

View the package here and read the full API documentation here


TO-DO List

Database Operations

  • DDBB
    • .use() (Middleware)
    • .addStore()
    • .dropDatabase()
    • Connections
  • Collections
    • .collectionsInfo()
    • .collections()
    • .collectionNames()
    • .collection()
    • .dropCollection()
    • .renameCollection()
    • .dropCollection()
    • .dropCollection()
    • .dropCollection()
  • Indexes
    • .createIndex()
    • .ensureIndex()
    • .dropIndex()
    • .reIndex()
    • .indexInformation()
  • db.runCommand()
    • User Commands
    • Database Operations
    • Internal Commands
    • Testing Commands
    • Auditing Commands

Read the full API documentation here


Collection

  • Creating
    • .insert()
  • Reading
    • .find()
    • .findOne()
  • Updating
    • .update()
  • Deleting
    • .remove()

Read the full API documentation here


Cursor

  • Fetching
    • .rewind()
    • .forEach()
    • .map()
    • .hasNext()
    • .next()
    • .fetchAll()
    • .fetchOne()
    • .count()
    • .sort()
    • .skip()
    • .limit()
  • Managing
    • .batchSize()
    • .close()
    • .comment()
    • .explain()
    • .hint()
    • .itcount()
    • .maxScan()
    • .maxTimeMS()
    • .max()
    • .min()
    • .noCursorTimeout()
    • .objsLeftInBatch()
    • .pretty()
    • .readConcern()
    • .readPref()
    • .returnKey()
    • .showRecordId()
    • .size()
    • .snapshot()
    • .tailable()
    • .toArray()

Read the full API documentation here


License

MIT

Project Statistics

Sourcerank 4
Repository Size 3.77 MB
Stars 8
Forks 7
Watchers 2
Open issues 11
Dependencies 194
Contributors 2
Tags 23
Created
Last updated
Last pushed

Top Contributors See all

eastolfi Coder of Salvation / Leon van Kammen

Packages Referencing this Repo

mongo-portable
Portable Pure JS MongoDB - Based on Monglodb (https://github.com/euforic/monglodb.git) by Christi...
Latest release 2.0.2 - Published - 8 stars
mongo-portable
Portable Pure JS MongoDB - Based on Monglodb (https://github.com/euforic/monglodb.git) by Christi...
Latest release 2.0.3 - Updated - 8 stars

Recent Tags See all

2.0.2 March 18, 2018
2.0.1 December 29, 2017
2.0.0 November 02, 2017
2.0.0-rc1 October 24, 2017
1.4.0 August 18, 2017
1.3.2 January 26, 2017
1.3.1 January 25, 2017
1.3.0 January 08, 2017
v1.2.1 August 07, 2016
v1.2.0 August 04, 2016
v1.1.9 August 01, 2016
v1.1.8 August 01, 2016
v1.1.7 June 11, 2016
v1.1.6 June 10, 2016
v1.1.5 June 09, 2016

Something wrong with this page? Make a suggestion

Last synced: 2018-08-12 21:29:16 UTC

Login to resync this repository