I am trying to sort a field, but I need to do it like how mysql does and specify the value,
instead of field number sory by -1, 4 3 2 1.
I need to sort it by 2,1,3,4.
is this possible in mongodb?
This is not possible in MongoDB. MongoDB doesn't know which and how many fields exist in a particular document unless the document is retrieved. Hence MongoDB practically cannot give numbers to specific fields.
MongoDB is a JSON-style data store. The documents stored in the database can have varying sets of fields, with different types for each field.
In Databases the number and types of the column is fixed by particular table definition and it's easier for a database system to give numbers to the columns.