Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write playground as TypeScript file #604

Open
DemianParkhomenko opened this issue Nov 5, 2023 · 5 comments
Open

Write playground as TypeScript file #604

DemianParkhomenko opened this issue Nov 5, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@DemianParkhomenko
Copy link

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.

@alenakhineika
Copy link
Contributor

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.

@alenakhineika alenakhineika added the enhancement New feature or request label Feb 5, 2024
@DemianParkhomenko
Copy link
Author

DemianParkhomenko commented Feb 5, 2024

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

@DemianParkhomenko
Copy link
Author

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

@fbgoat
Copy link

fbgoat commented Jul 22, 2024

Any update on this?

@alenakhineika
Copy link
Contributor

Please vote for this feature on the feedback forum to help us prioritize this work ⬆️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants