Comments (3)
from console.table.
Well, It's resolved by converting it to plain js object by using mongoose's lean
Below is the modified code:
const cTable = require('console.table');
const mongoose = require('mongoose');
mongoose.connect('mongodb:/host', {
auth: {
user: 'unm',
password: 'pwd'
}
});
const pairNm = 'BTC-INR-tx'
const pairModel = mongoose.model(pairNm, {}, pairNm);
pairModel.find({}, {_id: 0, trans_id: 1,
fill_qty: 1,
fill_price: 1,
fill_flags: 1,
currencyPair: 1,
lastModifiedDate: 1}).limit(10).lean().exec().then((d) => {
// console.log(d);
console.table('d', d);
});
Which results in beautiful tabled response:
d
---------------------------------------------------------------------------
trans_id fill_qty fill_price fill_flags currencyPair lastModifiedDate
-------- --------- ---------- ---------- ------------ ----------------
382 10000000 712500 3 BTC-INR 1521712287144
384 5000000 711800 2 BTC-INR 1521714892456
392 10000000 711200 1 BTC-INR 1521787237696
393 10000000 711200 3 BTC-INR 1521787298539
394 21168 715000 2 BTC-INR 1521790941289
395 978832 715000 3 BTC-INR 1521791070426
399 100000000 716000 3 BTC-INR 1521798458247
400 22510000 710000 2 BTC-INR 1521800843473
400 77490000 709000 1 BTC-INR 1521800843474
from console.table.
Mongoose response is not a plain js object, It has to be converted first before converting it to table structure.
from console.table.
Related Issues (15)
- Finish browser implementation HOT 1
- Question: Is it possible to use the first row as the title row? HOT 3
- Whitelist npm files
- Doesn't work in Node.js 8 HOT 9
- Feature request: Right alignment
- object whose properties are objects
- register with bower HOT 1
- Add to status page
- Add mocha unit test to grunt, including watch
- Add titles
- Can not work with node 0.8 HOT 2
- Print object as key / value table
- Enhancement : rotate/pivet table HOT 2
- Add semantic release
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from console.table.