GithubHelp home page GithubHelp logo

anwerj / mymongoviewcore Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 272 KB

The core npm package used to create my-mongo-view

Home Page: https://anwerj.github.io/mymongoview/#

JavaScript 61.49% CSS 9.52% HTML 28.98%
my-mongo-view mongodb-instance mongodb admin-ui simpleview

mymongoviewcore's Introduction

MyMongoView

MyMongoView provides easy, customizable views to query MongoDB. And above all that it gives most informative and beautiful approach to your MongoDB Document.

Go through documentation, with screenshots comment: # (head.installation)

Installation

Install MyMongoView from Github, and go to MyMongoView directory.

 git clone https://github.com/anwerj/MyMongoView.git && cd MyMongoView

Now, you need to install npm dependencies

 npm install my-mongo-view

Setup your MongoDB Connections from config.json file. There is a default connection with default views. Just change connections.string to your MongoDB instance.

You can also add multiple connections.

You are ready start application from index.js

 node index.js

Connection Parameters :

name : Name of the connection to remember by (kind of important)
string : Complete path to your MongoDB instances. (You can use authentication in string itself).

"string" : "mongodb://username:password@host/database"

container : Name to the directory where your views and cache are saved.

You can have multiple container, ideally a container belongs to one database. You can use same container for different environments.
A container must have two writable directories, views and cache.

config and options fields are not yet it used.

Views

Views are actually the queries which you hate to write. You can write views based on your collection, your primary keys or just for one single value to search for.

MyMongoView has its own structure for views which could be js|json file.

Views Parameters :

name : Name of the view to remember by (again kind of important)
collection : You can set a default collection to view. If set, it will query right when you open view, otherwise it will ask you to select a collection.
prompt : Perhaps the most important feature of MyMongoView. Here you defines your query.

Prompt is an object having collection fields as keys and operations + dataType as value.

A sample view

module.exports = {

    name : 'Orders',
    collection : 'orders',

    prompt : {
        buyer_id : {},
        order_status : { operators : { eq : '', gt : '' } },
        status : { dataType : 'number' }
    },

    join : {
        items : {on : 'parent', from : '_id'},
        buyers : {on : 'buyer_id', from : '_id'}
    }

};

Default values for operator is eq and dataType is string.

You can read more about prompts here

MyMongoView will return actual query with the result so that you don't get out of touch

Actions

Currently MyMongoView supports three actions find, aggregate and distinct. Every action comes with its own set of fields.

Find

Find actions accepts all filters and sort options.

Aggregate

Other that just filters and sort options, you will be asked for aggregate related fields like $group and $accumulator.

Distinct

This action will ask for key to find distinct values for. Remember it does not have limit so use vary carefully.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.