Question: I have a simple rails project that I've been playing around in with reactjs. To add some basic navigation, I brought the js-routes library in and it works great for urls that have a path parameter such as "localhost:3000/addresses/1". 

The problem I am facing is I am trying to call a "new" resource method and it adds the (::format) literally to the url which of course bombs as localhost:3000/addresses/new(.:format) is an invalid path. 

I reference the "new\_address\_path" path as specified in the routes-js docs. The rake output for this url is below:

```
new_address_path    GET /addresses/new(.:format)    addresses#new

```

The HTML snippet utilizing the above path looks like this:

```
<a href={Routes.new_address_path}>Create am address</a>

```

ENV:

```
-Ruby: 2.2.4
-Rails: 4.2.6
-js-routes: 1.2.8

```

Route in question:

```
resources :addresses

```

What am I missing here? It seems like it is not interpreting the rails route file properly.

Answer: 
Your **[`update`](https://docs.mongodb.com/manual/reference/method/db.collection.update/#db.collection.update)** statement is incorrect, it has misplaced arguments - you are putting multiple **[`$set`](https://docs.mongodb.com/manual/reference/operator/update/set/#up._S_set)** operations and options as different parameters to the update method; they should be under separate designated update parameters. The correct Node.js [syntax](http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#update) is:

```
update(selector, document, options, callback)

```

where `selector` is an object which is the selector/query for the update operation, `document` is also an object which is the update document and finally an `options`object which by default is null and has the optional update settings.

Here you are doing

```
update(selector, document, selector, document, options, options, callback)

```

In which mongo is updating the collection using the first two parameters as correct and it naturally throws the error

> 
> Error: Fourth argument must be empty when specifying upsert and multi
>  with an object.
> 
> 
> 

because you have too many incorrect parameters specified.

Also, you have incorrect usage of the positional operator. It should be part of the document to be updated, not in the query.

---

For the correct implementation, follow this update

```
db.getCollection('profiles').update(
    /* selector  */
    {
        "_id": ObjectId("57a9aa24e93864e02d91283c"),
        "ratings.round": 1
    }, 
    /* update document */
    {
        "$set": {
            "presentRound": 2,
            "interviewStatus": "in process",
            "scheduleInterviewStatus": false,
            "ratings.$.roundStatus": "selected"    
        }
    },
    /* optional settings */
    { upsert: true, multi: true }
)

```
replace {upsert:true} -> {upsert:true,strict: false}