@@ -275,34 +275,32 @@ describe('FLE tests', () => {
275
275
keyVault = client.getKeyVault();
276
276
clientEncryption = client.getClientEncryption();
277
277
278
- // Create necessary data + index keys
279
- dataKey1 = keyVault.createKey('local');
280
- dataKey2 = keyVault.createKey('local');
281
- indexKey = keyVault.createKey('local');
278
+ // Create necessary data key
279
+ dataKey = keyVault.createKey('local');
282
280
283
281
// (re-)create collection -- this needs to be done
284
282
// with the plain mongo client until MONGOCRYPT-435 is done
285
283
coll = client.getDB('${ dbname } ').encryptiontest;
286
284
Mongo(${ uri } ).getDB('${ dbname } ').createCollection('encryptiontest', {
287
285
encryptedFields: {
288
286
fields: [{
289
- keyId: indexKey ,
287
+ keyId: dataKey ,
290
288
path: 'v',
291
289
bsonType: 'string',
292
290
queries: [{ queryType: 'equality' }]
293
291
}]
294
292
}
295
293
});
296
294
297
- // Encrypt and insert data encrypted with different data keys and a separate index key
298
- const insertPayload1 = clientEncryption.encrypt(dataKey1 , '123', {
299
- indexKeyId: indexKey ,
300
- algorithm: 'Indexed'
295
+ // Encrypt and insert data encrypted with specified data key
296
+ const insertPayload1 = clientEncryption.encrypt(dataKey , '123', {
297
+ algorithm: 'Indexed' ,
298
+ contentionFactor: 4
301
299
});
302
300
303
- const insertPayload2 = clientEncryption.encrypt(dataKey2 , '456', {
304
- indexKeyId: indexKey ,
305
- algorithm: 'Indexed'
301
+ const insertPayload2 = clientEncryption.encrypt(dataKey , '456', {
302
+ algorithm: 'Indexed' ,
303
+ contentionFactor: 4
306
304
});
307
305
308
306
const insertRes1 = coll.insertOne({ v: insertPayload1, _id: 'asdf' });
@@ -312,10 +310,10 @@ describe('FLE tests', () => {
312
310
expect ( await shell . executeLine ( '({ count: coll.countDocuments() })' ) ) . to . include ( '{ count: 2 }' ) ;
313
311
314
312
await shell . executeLine ( `
315
- const findPayload = clientEncryption.encrypt(indexKey, '456', { // NB: the data key is irrelevant here
316
- indexKeyId: indexKey,
313
+ const findPayload = clientEncryption.encrypt(dataKey, '456', { // NB: the data key is irrelevant here
317
314
algorithm: 'Indexed',
318
- queryType: 'Equality'
315
+ queryType: 'equality',
316
+ contentionFactor: 4
319
317
});` ) ;
320
318
321
319
// Make sure the find payload allows searching for the encrypted value
0 commit comments