Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

coreio-mongodb

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coreio-mongodb

MongoDB integration for CoreIO

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
3
Weekly downloads
 
Created
Source

coreio-mongodb

Build Status

MongoDB integration for CoreIO

Install via npm

$ npm install coreio-mongodb
import CoreIO from 'coreio';
import MongoDBService from 'coreio-mongodb';

// set db conf
CoreIO.setConf('service.mongodb', {
  url: 'mongodb://localhost:27017',
  dbName: 'coreio-test'
});

const TodoModel = CoreIO.createModel('todo', {
  schema: {
    title: { type: 'string', min: 5, max: 100, required: true },
    content: { type: 'string', min: 0, max: 5000 },
    state: { type: 'number', default: 1 }
  },
  service: MongoDBService
});

export default TodoModel;

Import the model in your app, store data and save the model into a MongoDB

import TodoModel from '../path/to/model';

const model = new TodoModel();
model.set({
  title: 'Test model',
  content: 'This is a test content'
});

model.save().then((res) => {
  console.log('Item inserted with id', res.id);
});

Keywords

FAQs

Package last updated on 06 Aug 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc