Cursor Methods: Return Key
Returning only the indexes of a collection.
🪶 The returnKey method specifies that only document keys should be returned.
1 import MerlinDB, { Schema} from "@chrisaxxwell/merlin-db";2 //Or if you are using 'merlindb.max.js' just call 'new MerlinDB()'; 3 4 const merlin = new MerlinDB( ) ;5 merlin.connect( "USER-DATABASE") ; 6 var userModel = merlin.model( "User", <userSchema>) ;7 8 //cursor.returnKey(); 9 userModel.find( { name: "Maya" } ) .returnKey( ) .then( e => { 10 console.log( e) ; 11 //['name', 'age', ...] 12 } )