node-dao

0.8.2 • Public • Published

node-dao

Node-Dao - Simple MongoDb-like interface to MySql, PostgreSql, SqlLite and Mongo databases

look like this:

 
var rsa = await daoConnection.find({}).limit(2).sort({ name: 1 }).toArray();
 

find method samples:

 
find({value: {$gte: 25}})
 
find({value: {$ne: 4}})
 
find({age: {$gt: 20, $lt:10}})
 
find({age: {$gt: 20, $lt:10}})
 
find({age: {$gt: 20}, name: {$eq: “jenny”}});
 

so, dao request

find({name: {$eq: “john”}}).limit(1).sort({time: -1}).limit(1).toArray();

will be translated for MySQL like that

SELECT * FROM messages WHERE name = “john” ORDER BY name DESC LIMIT 1 OFFSET 1;

If you call count() instread toArray() then the request will be generated as:

SELECT count(*) FROM messages WHERE name = “john” LIMIT 1 OFFSET 1;

Readme

Keywords

none

Package Sidebar

Install

npm i node-dao

Weekly Downloads

2

Version

0.8.2

License

MIT

Unpacked Size

58.8 kB

Total Files

11

Last publish

Collaborators

  • f145h