Socket
Socket
Sign inDemoInstall

mongo-portable

Package Overview
Dependencies
13
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mongo-portable

Portable Pure JS MongoDB - Based on Monglodb (https://github.com/euforic/monglodb.git) by Christian Sullivan (http://RogueSynaptics.com)


Version published
Maintainers
1
Install size
14.5 MB
Created

Readme

Source

MongoPortable

Solution for a MongoDB-like portable database.

Package Version NodeJS Version

Travis Build Appveyor Build Codeship Build

Test Coverage Downloads Documentation Status

MongoPortable is a module that handles collections and documents in memory, and allow the use of stores for persistence.

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to eduardo.astolfi91.com.

Installation

npm install mongo-portable
yarn add mongo-portable

Usage

// Declaring the module dependency
import { MongoPortable } from "mongo-portable";

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

// Creates a new collection named "users" 
//      (if it's already created, it will just return it instead)
db.collection("users").then(collection => {
    // Inserts a new document into the collection
    collection.insert({ name: "John", lastName: "Abruzzi" }).then(document => {
        console.log(document);  // -> { name: "John", lastName: "Abruzzi" }
        
        // Performs a query against this collection, fetching all the results
        users.find({ name: "John" }).then(documents => {
            console.log(documents);  // -> [ { name: "John", lastName: "Abruzzi" } ]
        });
    });
});

Modules

The main modules available are MongoPortable and Collection (and Cursor when using the "doNotFetch" option).

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 file-system-store
yarn add file-system-store

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

import { FileSystemStore } from "file-system-store";

db.addStore(new FileSystemStore(/* options */));

or as a middleware:

import { FileSystemStore } from "file-system-store";

db.use("store", new FileSystemStore(/* options */));

View the package here and read the full API documentation here


Contributing

Feel free to contribute with your own ideas / fixes!

There is a [to-do list](#TO-DO List) with the features I'd like to add in the feature, and a serie of milestones with the roadmap I have in mind. Take a look at them if you want to :)

Every contribution should be addressed with a well-formed pull request -> Contributing


License

MIT

Keywords

FAQs

Last updated on 12 Aug 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc