Question: I try this:

```
<script type="text/javascript">
   $(document).ready(function() {
      $(".fb-like").attr('data-href',encodeURIComponent(location.href));
   });
</script>
<div class="fb-like" data-href="" data-send="false" data-width="450" data-show-faces="false" data-font="verdana"></div>

```

But data-href is empty.

Answer: 
I haven't checked the syntax. Also I don't know if your query works or not but here's my try.

```
        //unwind
        DBObject unwind = new BasicDBObject("$unwind", "$scorearray");
        // Now the $group operation
        DBObject groupFields = new BasicDBObject("player", "$player");
        groupFields.put("venue", "$scorearray.venue"));
        groupFields.put("score", "$scorearray.score"));
        DBObject group = new BasicDBObject("$group", new BasicDBObject("_id", groupFields));
        //sort
        DBObject sort = new BasicDBObject("$sort", new BasicDBObject("_id.score":1));
        //secondgroup
        DBObject secondGroupFields = new BasicDBObject("_id", "$_id.player")
        secondGroupFields.put("maxScore", new BasicDBObject("$last":"$_id.score"));
        secondGroupFields.put("venue", new BasicDBObject("$last":"$_id.venue"));
        DBObject secondGroup = new BasicDBObject("$group", secondGroupFields);

        // run aggregation
        AggregationOutput output = playerScoreCollection.aggregate(unwind, group,sort,secondGroup);

        Iterable<DBObject> result = output.results();
        Iterator<DBObject> iterator = result.iterator();

```
You can use this library:
<https://github.com/EqualExperts/mongo-shell-like-query>
With this library you can use query string like:

> 
> db.users.aggregate([{'$match':{'salary' : {$gte:'from#Long',$lte:'to#Long'}}}, { $group: {\_id:'$role', 'age': {$sum: '$age' } } }, { '$sort': { 'age': -1 } }, { '$limit': 5 }])
> 
> 
> 

or

> 
> db.users.aggregate({'$match':{'salary' : {$gte:'from#Long',$lte:'to#Long'}}}, { $group: {\_id:'$role', 'age': {$sum: '$age' } } }, { '$sort': { 'age': -1 } }, { '$limit': 5 })
> 
> 
> 

passing these strings like this example:
 String query = ”db.users.find( { ‘name’ : ‘John’} )”;
 MongoQueryParser parser = new MongoQueryParser();
 MongoQuery mongoQuery = parser.parse(query, new HashMap());
 BasicDBList results = mongoQuery.execute(mongoDB);
It's very very fast to integrate and use in my opinion.

In alternative there is another fantastic library:

<http://jongo.org>

With this you can use code like:

```
DB db = new MongoClient().getDB("dbname");
Jongo jongo = new Jongo(db);
MongoCollection friends = jongo.getCollection("friends");
friends.aggregate("{$project:{sender:1}}")
    .and("{$match:{tags:'read'}}")
    .and("{$limit:10}")
    .as(Email.class);

```