Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Submitted
Categories IDEs
Created by Guest
Created on Feb 5, 2024

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. ```ts 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 global and transpile the file into js before running. See GitHub issue: https://github.com/mongodb-js/vscode/issues/604
  • Guest
    Nov 14, 2024
    without it I cannot import my data to the playground