TylerBrock / mongo-hacker

MongoDB Shell Enhancements for Hackers
tylerbrock.github.io/mongo-hacker
MIT License
1.79k stars 235 forks source link

Feature request: Autocomplete fields #192

Closed gianpaj closed 5 years ago

gianpaj commented 6 years ago

Imagine you have a document like this:

{
  "_id": ObjectId("5af9faca151df625830bbfe1"),
  "accountStatus": "verified",
  "username": "gianpaj",
  "emailAddress": "gianpa@gmail.com",
  "createdAt": ISODate("2018-05-14T21:08:26.339Z"),
  "updatedAt": ISODate("2018-08-10T13:06:54.809Z"),
  "platform": "android",
  "bio": "Welcome to Onova! Send us questions or feedback to gianfranco@onova.co or via Chat on one of my items.\nLviv, Ukraine",
  "displayName": "Gianfranco (Onova CTO)",
  "profilePic": "http://assets.onova.co/users/5af9faca151df625830bbfe1-1529350817468.jpg",
}

Wouldn't it be amazing if you could start typing a field, form exampleuser.. press Tab and boom! it autocompletes?! ✨

magic

dandv commented 5 years ago

https://github.com/nosqlclient/nosqlclient has field autocomplete.

stennie commented 5 years ago

Field autocompletion would be a helpful feature, but since MongoDB currently doesn't have a catalog for collection schema this would require regular schema analysis to infer available fields.

I'm also not sure if tab completion of function parameters is possible in the current mongo shell without modifications to the C++ line handling. Mongo Hacker is limited to augmenting existing behavior using JavaScript.

Unfortunately I think this level of magic is outside the scope of what can easily be achieved in Mongo Hacker and would be better handled in a full shell implementation.

Regards, Stennie