summaryrefslogtreecommitdiff
path: root/jstests/core/fts_blogwild.js
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:17:50 -0500
committerJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:18:14 -0500
commit4ae691e8edc87d0e3cfb633bb91c328426be007b (patch)
tree52079a593f54382ca13a2e741633eab1b6271893 /jstests/core/fts_blogwild.js
parenta025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff)
downloadmongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/core/fts_blogwild.js')
-rw-r--r--jstests/core/fts_blogwild.js60
1 files changed, 30 insertions, 30 deletions
diff --git a/jstests/core/fts_blogwild.js b/jstests/core/fts_blogwild.js
index e220bd89032..dad96cd2836 100644
--- a/jstests/core/fts_blogwild.js
+++ b/jstests/core/fts_blogwild.js
@@ -1,40 +1,40 @@
t = db.text_blogwild;
t.drop();
-t.save( { _id: 1 , title: "my blog post" , text: "this is a new blog i am writing. yay eliot" } );
-t.save( { _id: 2 , title: "my 2nd post" , text: "this is a new blog i am writing. yay" } );
-t.save( { _id: 3 , title: "knives are Fun for writing eliot" , text: "this is a new blog i am writing. yay" } );
+t.save({_id: 1, title: "my blog post", text: "this is a new blog i am writing. yay eliot"});
+t.save({_id: 2, title: "my 2nd post", text: "this is a new blog i am writing. yay"});
+t.save({
+ _id: 3,
+ title: "knives are Fun for writing eliot",
+ text: "this is a new blog i am writing. yay"
+});
// default weight is 1
// specify weights if you want a field to be more meaningull
-t.ensureIndex( { dummy: "text" } , { weights: "$**" } );
+t.ensureIndex({dummy: "text"}, {weights: "$**"});
-res = t.find( { "$text" : { "$search": "blog" } } );
-assert.eq( 3 , res.length() , "A1" );
+res = t.find({"$text": {"$search": "blog"}});
+assert.eq(3, res.length(), "A1");
-res = t.find( { "$text" : { "$search": "write" } } );
-assert.eq( 3 , res.length() , "B1" );
+res = t.find({"$text": {"$search": "write"}});
+assert.eq(3, res.length(), "B1");
// mixing
-t.dropIndex( "dummy_text" );
-assert.eq( 1 , t.getIndexKeys().length , "C1" );
-t.ensureIndex( { dummy: "text" } , { weights: { "$**": 1 , title: 2 } } );
-
-
-res = t.find( { "$text" : { "$search": "write" } }, { score: { "$meta" : "textScore" } } ).sort( { score: { "$meta" : "textScore" } });
-assert.eq( 3 , res.length() , "C2" );
-assert.eq( 3 , res[0]._id , "C3" );
-
-res = t.find( { "$text" : { "$search": "blog" } }, { score: { "$meta" : "textScore" } } ).sort( { score: { "$meta" : "textScore" } });
-assert.eq( 3 , res.length() , "D1" );
-assert.eq( 1 , res[0]._id , "D2" );
-
-res = t.find( { "$text" : { "$search": "eliot" } }, { score: { "$meta" : "textScore" } } ).sort( { score: { "$meta" : "textScore" } });
-assert.eq( 2 , res.length() , "E1" );
-assert.eq( 3 , res[0]._id , "E2" );
-
-
-
-
-
-
+t.dropIndex("dummy_text");
+assert.eq(1, t.getIndexKeys().length, "C1");
+t.ensureIndex({dummy: "text"}, {weights: {"$**": 1, title: 2}});
+
+res = t.find({"$text": {"$search": "write"}}, {score: {"$meta": "textScore"}})
+ .sort({score: {"$meta": "textScore"}});
+assert.eq(3, res.length(), "C2");
+assert.eq(3, res[0]._id, "C3");
+
+res = t.find({"$text": {"$search": "blog"}}, {score: {"$meta": "textScore"}})
+ .sort({score: {"$meta": "textScore"}});
+assert.eq(3, res.length(), "D1");
+assert.eq(1, res[0]._id, "D2");
+
+res = t.find({"$text": {"$search": "eliot"}}, {score: {"$meta": "textScore"}})
+ .sort({score: {"$meta": "textScore"}});
+assert.eq(2, res.length(), "E1");
+assert.eq(3, res[0]._id, "E2");