vscode
vscode copied to clipboard
Write playground as TypeScript file
Feature Request
It would be nice to write MongoDB playground in Typescript, then we will have design time validation and good suggestions in IDE.
Detailed Description
It would be awesome to have types for MongoDB interfaces and the ability to import your own types.
import {Sale} from './types';
use('mongodbVSCodePlaygroundDB');
const sales: Sale[] = [
{ 'item': 'abc', 'price': 10, 'quantity': 2, 'date': new Date('2014-03-01T08:00:00Z') },
{ 'item': 'jkl', 'price': 20, 'quantity': 1, 'date': new Date('2014-03-01T09:00:00Z') },
{ 'item': 'xyz', 'price': 5, 'quantity': 10, 'date': new Date('2014-03-15T09:00:00Z') },
{ 'item': 'xyz', 'price': 5, 'quantity': 20, 'date': new Date('2014-04-04T11:21:39.736Z') },
{ 'item': 'abc', 'price': 10, 'quantity': 10, 'date': new Date('2014-04-04T21:23:13.331Z') },
{ 'item': 'def', 'price': 7.5, 'quantity': 5, 'date': new Date('2015-06-04T05:08:13Z') },
{ 'item': 'def', 'price': 7.5, 'quantity': 10, 'date': new Date('2015-09-10T08:43:00Z') },
{ 'item': 'abc', 'price': 10, 'quantity': 5, 'date': new Date('2016-02-06T20:20:13Z') },
]
db.getCollection('sales').insertMany(sales);
Possible Implementation
We can define global.d.ts for MongoDB db gloabls as use, db and transpile the file into js before running.
Hey, this should be a nice feature to have! Could you post your idea on our feedback forum so people can vote for it? This will help us prioritize the work.
Hey, this should be a nice feature to have! Could you post your idea on our feedback forum so people can vote for it? This will help us prioritize the work.
Yes, of course. I'll add it
Hey, this should be a nice feature to have! Could you post your idea on our feedback forum so people can vote for it? This will help us prioritize the work.
Done
https://feedback.mongodb.com/forums/929236-mongodb-for-vs-code/suggestions/47715974-write-playground-as-typescript-file