Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stpettersens/mysql-as-mongo
Use MySQL in Node.js as if it was MongoDB.
https://github.com/stpettersens/mysql-as-mongo
Last synced: about 1 month ago
JSON representation
Use MySQL in Node.js as if it was MongoDB.
- Host: GitHub
- URL: https://github.com/stpettersens/mysql-as-mongo
- Owner: stpettersens
- License: other
- Created: 2015-02-22T17:23:36.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-04-15T01:09:06.000Z (over 9 years ago)
- Last Synced: 2023-03-11T09:27:39.931Z (almost 2 years ago)
- Language: JavaScript
- Size: 172 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
# MySQL as MongoDB for Node.js
Use MySQL in Node.js as if it was MongoDB.
Drop in replacement for MongoDB database code.That is, you can use JSON / CSON / JavaScript objects to insert data into a MySQL backend.
For example:
```
var db = require('db-mysql');var _pineapple = {
name: 'Pineapple',
genus: 'Ananas comosus',
nativeTo: 'South America'
};db.open(function() {
console.log('Created new schema!');
});db.insertOne('fruit', _pineapple, function(err, pineapple) {`
console.log('Added %s (%s) to fruit schema.', pineapple.name, pineapple.genus);`
});
```will be converted by `db-mysql.js` to this SQL and stored in a MySQL schema:
```
INSERT INTO fruit (_id, name, genus, nativeTo)
VALUES ('54e64cbed9bd98fc247c7b6f', 'Pineapple', 'Ananas comosus', 'South America')
```