javascript - How can I use $each and $position while using $push with a variable field name? -


this code working me:

var currentuser = meteor.userid() var json = {} json[currentuser] = {score: -1, created: new date()} words.update({_id: word._id}, {         $push: json     } ) 

but put new array items @ 0 position.

how can modify code use $each , $position?

i don't know meteor, in plain javascript need mention field name after $push, , push variable @ first place below query.

 words.update({_id: word._id}, {             $push: {field_name: {                $each: [ json ],                $position: 0             }}         }     ) 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -